Meteor check, registration, etc. Email through a third-party email program

I would like Meteor to use a third-party API (in my case, Mandrill) for sendVerificationEmail , sendEnrollmentEmail , etc. Has anyone got this job?

EDIT: In particular, I would like to use the templates that I have in Mandrill for these system letters. I assume that I will have to change some functions in the Accounts package to send names, tokens, etc. In Mandrill through an API call. If someone has already done this, I would like to hear about it.

+6
source share
3 answers

Super easy to do this with mandrill package in atmosphere

 meteor add timmyg13:mandrill 

Then just configure it on the server side:

 # in server code Meteor.startup(function() { Meteor.Mandrill.config({ username: "YOUR_MANDRILL_USERNAME", key: "YOUR_MANDRILL_API_KEY" }); }); 

And you are tuned!

As he does this, he installs your smtp-url on the smtp mandrill server, so everything that uses the Meteor email package will work (for example, password-password)

+4
source

just change the process.env.MAIL_URL variable and use something like this:

 this.process.env.MAIL_URL = "smtp://{{foobar%40gmail.com}}:{{apikey}}@smtp.mandrillapp.com:587/"; 

the package that @Akshat said does just that, and as he mentioned, the username and apikey should be generated using "encodeURIComponent"

+1
source

If you want to use your templates, the trick:

1) Have Mandrill Render them through the wylio: mandrill package. 2) Send the displayed html / text through the Meteor account package.

Check out this link for sample code: https://forums.meteor.com/t/sending-meteors-verification-email-with-mandrill/7485

0
source

Source: https://habr.com/ru/post/972778/


All Articles