Package in Go for sending emails. Encapsulates jordan-wright/email. Probably not useful for anybody else than me.
emailer := email.NewClient()
_ := emailer.Sendmail("John Doe", "jd@example.com", "Subject", "Some message")
emailer := email.NewClient()
emailer.To("John Doe", "john@example.com")
emailer.Subject("Subject of message")
emailer.BodyText("A bit of a message")
_ := emailer.Send()
Create a new email object with the NewClient function. It takes a variadic number of configuration functions as parameters
emailer := email.NewClient(
email.WithRelayhost("smtp.example.com", 465),
)
emailer := email.NewClient(
email.WithAuth("your.name@example.com", "123456789abcde", true),
)
emailer := email.NewClient(
email.WithSender("Example Inc. Customer Service", "info@example.com"),
)
emailer := email.NewClient(
email.WithDontSend(),
)
All possible configuration functions can be combined:
emailer := email.NewClient(
email.WithRelayhost("smtp.fastmail.com", 465),
email.WithAuth("your.name@example.com", "123456789abcde"),
email.WithSender("Example Inc. Customer Service", "info@example.com"),
email.WithDontSend(),
)
You can install this package in your project by running:
go get -u github.com/jakoubek/emaillib