queue sends the email immediately via SMTP.
(subject, from string, to []string, contentType, body string)
| 110 | |
| 111 | // queue sends the email immediately via SMTP. |
| 112 | func (b *DefaultBackend) queue(subject, from string, to []string, contentType, body string) error { |
| 113 | m := gomail.NewMessage() |
| 114 | m.SetHeader("From", from) |
| 115 | m.SetHeader("To", to...) |
| 116 | m.SetHeader("Subject", subject) |
| 117 | m.SetBody(contentType, body) |
| 118 | |
| 119 | if err := b.Dialer.DialAndSend(m); err != nil { |
| 120 | return errors.Wrap(err, "dialing and sending email") |
| 121 | } |
| 122 | |
| 123 | return nil |
| 124 | } |
| 125 | |
| 126 | // StdoutBackend is an implementation of the Backend |
| 127 | // that prints emails to stdout instead of sending them. |