mail.go 909 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package mailer
  5. import (
  6. "github.com/gogits/gogs/models"
  7. "github.com/gogits/gogs/modules/base"
  8. )
  9. // Create New mail message use MailFrom and MailUser
  10. func NewMailMessage(To []string, subject, body string) Message {
  11. msg := NewHtmlMessage(To, base.MailService.User, subject, body)
  12. msg.User = base.MailService.User
  13. return msg
  14. }
  15. func GetMailTmplData(user *models.User) map[interface{}]interface{} {
  16. data := make(map[interface{}]interface{}, 10)
  17. data["AppName"] = base.AppName
  18. data["AppVer"] = base.AppVer
  19. data["AppUrl"] = base.AppUrl
  20. data["AppLogo"] = base.AppLogo
  21. data["ActiveCodeLives"] = base.Service.ActiveCodeLives
  22. data["ResetPwdCodeLives"] = base.Service.ResetPwdCodeLives
  23. if user != nil {
  24. data["User"] = user
  25. }
  26. return data
  27. }