MCPcopy Create free account
hub / github.com/gogs/gogs / SendActivateEmailMail

Function SendActivateEmailMail

internal/email/email.go:130–147  ·  view source on GitHub ↗

SendActivateAccountMail sends confirmation email.

(c *macaron.Context, u User, email string)

Source from the content-addressed store, hash-verified

128
129// SendActivateAccountMail sends confirmation email.
130func SendActivateEmailMail(c *macaron.Context, u User, email string) {
131 data := map[string]any{
132 "Username": u.DisplayName(),
133 "ActiveCodeLives": conf.Auth.ActivateCodeLives / 60,
134 "Code": u.GenerateEmailActivateCode(email),
135 "Email": email,
136 }
137 body, err := render(tmplAuthActivateEmail, data)
138 if err != nil {
139 log.Error("HTMLString: %v", err)
140 return
141 }
142
143 msg := NewMessage([]string{email}, c.Tr("mail.activate_email"), body)
144 msg.Info = fmt.Sprintf("UID: %d, activate email", u.ID())
145
146 Send(msg)
147}
148
149// SendRegisterNotifyMail triggers a notify e-mail by admin created a account.
150func SendRegisterNotifyMail(c *macaron.Context, u User) {

Callers 1

SettingsEmailPostFunction · 0.92

Calls 8

renderFunction · 0.85
NewMessageFunction · 0.85
SendFunction · 0.85
TrMethod · 0.80
DisplayNameMethod · 0.65
IDMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected