MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / SendActiveEmail

Method SendActiveEmail

services/email.service.go:96–114  ·  view source on GitHub ↗

SendActiveEmail function

(q bson.M)

Source from the content-addressed store, hash-verified

94
95// SendActiveEmail function
96func (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
117func (emailService *EmailService) SendNotificationEmail(email string, subject string, message string, lang string) (success bool, err error) {

Callers 2

CreateMethod · 0.80
ActivateMethod · 0.80

Calls 3

loadEmailFunction · 0.85
SendMailFunction · 0.85
getCollectionMethod · 0.45

Tested by

no test coverage detected