Sending Emails in Buffalo
In this video we will look at how we can use the github.com/gobuffalo/x/mail
package to send emails within a Buffalo application. We’ll see how to set multiple bodies, as well as an attachment, to the email. This video also demonstrates the new buffalo-mail
plugin for this package.
Installation
Install the github.com/gobuffalo/x/mail
package:
$ go get -u -v github.com/gobuffalo/x/mail
Install the buffalo-mail
generator plugin:
$ go install -v github.com/gobuffalo/x/mail/buffalo-mail
Usage
To use the buffalo-mail
plugin, first go to your Buffalo application’s root directory. Then generate a new mailer:
$ buffalo g mailer <name-of-email>
Configure the mailers/mailers.go
file with your SMTP settings.
Enjoy! :)
Are you a company looking for Buffalo or Go training? The Gopher Guideswant to help. With customizable onsite and virtual training, the Guides will bring your team up to speed quickly, and with the knowledge they need to write great code on a daily basis.