Accounts.sendVerificationEmail(), Send mail over API call rather than SMTP

Hello,

Right now, the accounts-password package only support sending verification email over SMTP, via Accounts.sendVerificationEmail() using the Email.send() method.

I could not find any way/hacks to customize the behaviour of Accounts.sendVerificationEmail() , to send the mail with Mailgun API for example.

I have two question :

  • Is customizing the way accounts-password sends mails even on the roadmap ? If not, I would like to propose the idea and fork the official repo.

  • How do you propose features for meteor official core packages ?

Thank you !

1 Like

You would need to override https://github.com/meteor/meteor/blob/devel/packages/email/email.js#L85 for example to direct all mail like you want.

Since the accounts packages use that email package.

You could do that by downloading it in your packages folder and using a local copy. Another way could be to override the Email object but that does not seem like an easy job because the function is private.

I don’t think customizing Accounts.sendVerificationEmail is the way to go. Email.send already allows you to specify your own MAIL_URL, which can also be used to send emails through Mailgun. See this Meteor Chef article for more information.

In general, the best way to propose a feature is to either discuss your use case and proposal first on the forum (if it is more open ended) or open an issue on GitHub if you have a specific feature request in mind.

You would need to override https://github.com/meteor/meteor/blob/devel/packages/email/email.js#L85 for example to direct all mail like you want.

Ok that is what I thought,
Thank you, I’ll give it a try !

Email.send already allows you to specify your own MAIL_URL
See this Meteor Chef article2 for more information.

Yes, but using the SMTP protocol, which I don’t want to use.

My objective is to use mailgun API to send verification mail, which is not possible at the time, as you can only send mail via SMTP with Email.send()

1 Like

The API has more options which can gives advantages. For example tagging all messages so you can see issues per type of messages.

I have projects with Mailgun SMTP working without issues anyway so yes normally this is a good solution.

I have the same objective.

meteor should allow developers to get these sort of things quickly working without SMTP

##Mailgun accounts-ui should be available
Can I ask what you ended up doing to work around or solve?

I dit not !

Every email sent by my app is going through Mailgun API, except for the verificationEmail which is sent via SMTP.

I never found a way to use the verification mail using an API rather than SMTP, and didn’t want to spend too much time at the time.

Sorry to hear.

A Mailgun-accounts connection is sorely needed as alternative to SMTP.

Seems the current team are ruining Meteor’s usefulness with their React fetish?
Sad.

This might be a bit late, but you can try something like this: https://gist.github.com/solace/cb927e62ea8502d21895cd53e75edded

I’ve set the fallback so that I can test with and without the alternate service. Currently using it with mailgun API.

Obviously, test it to make sure it has the desired effect before pumping a tonne of messages through.

5 Likes

funny hack, but we wanted to send our verification emails using a handlebars template in Mandrill, so we set use Mandrill’s SMPT for our all emails, then we send the verification email’s subject to “killme” then made a rule in Mandrill to reject any email with subject “killme”. Then we just pass the activationUrl to our custom Mandrill template.