MCPcopy
hub / github.com/mcuadros/ofelia / Run

Method Run

middlewares/mail.go:53–65  ·  view source on GitHub ↗

Run sents a email with the result of the execution

(ctx *core.Context)

Source from the content-addressed store, hash-verified

51
52// Run sents a email with the result of the execution
53func (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
67func (m *Mail) sendMail(ctx *core.Context) error {
68 msg := gomail.NewMessage()

Callers 1

TestRunSuccessMethod · 0.95

Calls 4

sendMailMethod · 0.95
NextMethod · 0.80
ErrorfMethod · 0.65
StopMethod · 0.45

Tested by 1

TestRunSuccessMethod · 0.76