view pkg/misc/mail.go @ 942:912d016275ee

client: add arrow to drawn linesegment * Add styling function that will place an icon png image at the end of each drawn line segment, in the right rotation. Note that this does not look perfectly centered, see comment in the code.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 09 Oct 2018 18:39:01 +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)
}