Sendgrid is one of the most well-known and used email delivering solutions. It has solutions for most (if not all) of the common email sending and delivering issues that we could face as developers. But this post is not about convincing you to use Sendgrid.
One of the things I love about Buffalo is that it ships with all of the things a product needs for rapid application development and deployment. In this case that is email. Buffalo has a mail
package that you can use to integrate sendgrid or any other provider with your app.
import github.com/buffalo/mail
Buffalo’s mail
package key items are the Sender
interface and the Message
struct. It also ships with an SMTPSender
implementation of the Sender
interface which could be used if you have an SMTP
server or want to use your gmail/hotmail email to send emails. I do not recommend you to use a single email account for SMTP on production environments but it could be useful when doing very quick iterations and hacks.
Sender interface
The Sender interface is a very simple interface which is defined as: