package notify import ( "errors" "net/mail" "net/smtp" "github.com/scorredoira/email" ) type SmtpAuth struct { Addr string Auth smtp.Auth } func SendEmailHTML(auth SmtpAuth, message, subject string, from mail.Address, to ...mail.Address) error { if len(to) == 0 { return errors.New("expected least one receiver") } mes := email.NewMessage(subject, message) mes.BodyContentType = "text/html;" mes.From = from for _, ito := range to { mes.AddTo(ito) } return email.Send(auth.Addr, auth.Auth, mes) } func SenndEmailMessage(auth SmtpAuth, mes *email.Message) error { return email.Send(auth.Addr, auth.Auth, mes) }