Example #1
0
func getMailRecepients(ctxt string, dbProvider dbprovider.DbInterface) ([]string, error) {
	var users []models.User
	var recepients []string
	users, err := dbProvider.UserInterface().Users(bson.M{"notificationenabled": true})
	if err != nil {
		logger.Get().Critical(fmt.Sprintf("%s-Could not retrieve the list of users from DB. Error: %v", ctxt, err))
		return recepients, err
	}
	for _, user := range users {
		recepients = append(recepients, user.Email)
	}
	return recepients, nil
}