MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / Send

Method Send

api/pkg/emails/smtp_mailer_service.go:41–58  ·  view source on GitHub ↗

Send a new email

(ctx context.Context, email *Email)

Source from the content-addressed store, hash-verified

39
40// Send a new email
41func (mailer *smtpMailer) Send(ctx context.Context, email *Email) (err error) {
42 ctx, span := mailer.tracer.Start(ctx)
43 defer span.End()
44
45 e := mail.NewEmail()
46 e.From = mailer.from
47 e.To = []string{email.toAddress()}
48 e.Subject = email.Subject
49 e.Text = []byte(email.Text)
50 e.HTML = []byte(email.HTML)
51
52 err = e.Send(mailer.address, mailer.auth)
53 if err != nil {
54 return stacktrace.Propagate(err, "cannot send email")
55 }
56
57 return nil
58}

Callers

nothing calls this directly

Calls 3

toAddressMethod · 0.80
StartMethod · 0.65
SendMethod · 0.65

Tested by

no test coverage detected