SendActiveEmail function
(q bson.M)
| 94 | |
| 95 | // SendActiveEmail function |
| 96 | func (emailService *EmailService) SendActiveEmail(q bson.M) (success bool, err error) { |
| 97 | user := &models.User{} |
| 98 | var userService = UserService{} |
| 99 | err = userService.getCollection().First(q, user) |
| 100 | if err != nil { |
| 101 | return false, err |
| 102 | } |
| 103 | frontendLoginURL := os.Getenv("FRONTEND_LOGIN_URL") |
| 104 | |
| 105 | engine := liquid.NewEngine() |
| 106 | emailModel, _ := loadEmail("activate", user.Language) |
| 107 | bindings := map[string]interface{}{ |
| 108 | "email": user.Email, |
| 109 | "frontendLoginURL": frontendLoginURL, |
| 110 | } |
| 111 | result, err := engine.ParseAndRenderString(string(emailModel.Body), bindings) |
| 112 | err = SendMail(os.Getenv("DEFAULT_EMAIL_FROM"), emailModel.Subject, result, []string{user.Email}) |
| 113 | return true, err |
| 114 | } |
| 115 | |
| 116 | // SendNotificationEmail function |
| 117 | func (emailService *EmailService) SendNotificationEmail(email string, subject string, message string, lang string) (success bool, err error) { |
no test coverage detected