本文整理汇总了Golang中github.com/playaer/myFirstGoProject/di.DI.Mailer方法的典型用法代码示例。如果您正苦于以下问题:Golang DI.Mailer方法的具体用法?Golang DI.Mailer怎么用?Golang DI.Mailer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/playaer/myFirstGoProject/di.DI
的用法示例。
在下文中一共展示了DI.Mailer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ProcessRegister
// Process register: check form, create new inactive user and send activation email
func (self *RegisterController) ProcessRegister(params martini.Params, req *http.Request, r render.Render, di *di.DI) {
userManager := di.UserManager()
user := userManager.NewUser()
// need validate
user.Email = req.FormValue("Email")
rawPassword := req.FormValue("Password")
user.Password = userManager.CryptPassword(rawPassword)
user.FullName = req.FormValue("FullName")
user.Address = req.FormValue("Address")
user.Phone = req.FormValue("Phone")
user.IsActive = false
user.Hash = userManager.GenerateHash(user.Email + user.FullName)
userManager.Create(user)
// send email
mailer := di.Mailer()
go mailer.Send(mailer.BuildRegistrationMail(user))
// message: "Activation link was sent to your email."
r.Redirect("/users/")
}