jordan-wright / email

Robust and flexible email library for Go
MIT License
2.65k stars 321 forks source link

Consider the Use of a Sender Interface #33

Open jordan-wright opened 8 years ago

jordan-wright commented 8 years ago

It would be nice to have flexibility with how emails are sent. For example, providers like MailChimp, Sendgrid, etc. all use API's to send emails.

Ideally, I could see us changing the signature for email.Send() to, instead of taking an smtp.Auth object, taking anything that implements the Sender interface.

This interface could be simple:

type Sender interface {
    Send(e Email) (err error)
}

We could also do this via another method such as SendWithSender() or similar. This way, people could send the email using whatever client they wanted.

We could then provide various clients in a separate package: email/senders that support various APIs.

jordan-wright commented 8 years ago

Going to make this a higher priority now that https://github.com/gophish/gophish/issues/77 depends on this being possible.