domodwyer / mailyak

An elegant MIME/SMTP email library with support for attachments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Allow changing the host and auth

Coronon opened this issue · comments

Hi there,

I discovered your awesome package and everything works very well.
The only little problem I have is that when trying out multiple servers to send emails to (in order by MX preference) I have to completly reconstruct the email each time as there is no way to simply change the host(+sender) and auth fields on the MailYak struct.

Adding two little options to change these after constructing the instance would save a lot of time :)

commented

I can certainly see the utility of it! Have you profiled / identified it as a bottleneck - I think (but will double check) that generating the MailYak instances is pretty cheap so would be surprised if it's a problem!

If it is generating the email body that's expensive, perhaps you can reuse it? Like this as an example. You could even skip the template email entirely, and just feed it a bytes.Buffer directly that you cache.