Mercurial > gemma
view pkg/misc/mail.go @ 868:aa8f30c1ed27 geo-style
Moved GeoServer configuration to own package.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 29 Sep 2018 22:34:24 +0200 |
parents | c1047fd04a3a |
children | a244b18cb916 |
line wrap: on
line source
package misc import ( gomail "gopkg.in/gomail.v2" "gemma.intevation.de/gemma/pkg/config" ) func SendMail(email, subject, body string) error { m := gomail.NewMessage() m.SetHeader("From", config.MailFrom()) m.SetHeader("To", email) m.SetHeader("Subject", subject) m.SetBody("text/plain", body) d := gomail.Dialer{ Host: config.MailHost(), Port: int(config.MailPort()), Username: config.MailUser(), Password: config.MailPassword(), LocalName: config.MailHelo(), SSL: config.MailPort() == 465, } return d.DialAndSend(m) }