Run sents a email with the result of the execution
(ctx *core.Context)
| 51 | |
| 52 | // Run sents a email with the result of the execution |
| 53 | func (m *Mail) Run(ctx *core.Context) error { |
| 54 | err := ctx.Next() |
| 55 | ctx.Stop(err) |
| 56 | |
| 57 | if ctx.Execution.Failed || !m.MailOnlyOnError { |
| 58 | err := m.sendMail(ctx) |
| 59 | if err != nil { |
| 60 | ctx.Logger.Errorf("Mail error: %q", err) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | return err |
| 65 | } |
| 66 | |
| 67 | func (m *Mail) sendMail(ctx *core.Context) error { |
| 68 | msg := gomail.NewMessage() |