emails.go 668 B

12345678910111213141516171819202122232425262728293031
  1. package models
  2. type SendEmailCommand struct {
  3. To []string
  4. From string
  5. Subject string
  6. Body string
  7. Massive bool
  8. Info string
  9. }
  10. type SendResetPasswordEmailCommand struct {
  11. User *User
  12. }
  13. // create mail content
  14. func (m *SendEmailCommand) Content() string {
  15. contentType := "text/html; charset=UTF-8"
  16. content := "From: " + m.From + "\r\nSubject: " + m.Subject + "\r\nContent-Type: " + contentType + "\r\n\r\n" + m.Body
  17. return content
  18. }
  19. // Create html mail command
  20. func NewSendEmailCommand(To []string, From, Subject, Body string) SendEmailCommand {
  21. return SendEmailCommand{
  22. To: To,
  23. From: From,
  24. Subject: Subject,
  25. Body: Body,
  26. }
  27. }