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

Function SendUserMail

internal/email/email.go:102–119  ·  view source on GitHub ↗
(_ *macaron.Context, u User, tpl, code, subject, info string)

Source from the content-addressed store, hash-verified

100}
101
102func SendUserMail(_ *macaron.Context, u User, tpl, code, subject, info string) {
103 data := map[string]any{
104 "Username": u.DisplayName(),
105 "ActiveCodeLives": conf.Auth.ActivateCodeLives / 60,
106 "ResetPwdCodeLives": conf.Auth.ResetPasswordCodeLives / 60,
107 "Code": code,
108 }
109 body, err := render(tpl, data)
110 if err != nil {
111 log.Error("render: %v", err)
112 return
113 }
114
115 msg := NewMessage([]string{u.Email()}, subject, body)
116 msg.Info = fmt.Sprintf("UID: %d, %s", u.ID(), info)
117
118 Send(msg)
119}
120
121func SendActivateAccountMail(c *macaron.Context, u User) {
122 SendUserMail(c, u, tmplAuthActivate, u.GenerateEmailActivateCode(u.Email()), c.Tr("mail.activate_account"), "activate account")

Callers 2

SendActivateAccountMailFunction · 0.85
SendResetPasswordMailFunction · 0.85

Calls 7

renderFunction · 0.85
NewMessageFunction · 0.85
SendFunction · 0.85
DisplayNameMethod · 0.65
EmailMethod · 0.65
IDMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected