DEV Community

Reaper
Reaper

Posted on • Edited on

Mailer - Nodemon as a microservice

I've been using Email based sign in or Magic Link sign in for almost all my projects and I end up setting up SendGrid or Nodemailer based on how much I think the project will grow. If it's a hobby project , I know that no one other than me will use it, so SendGrid works fine for that, on the other hand. If it's something I've built and promoted for people to use, and I see a good amount of people using the platform , I need to shift to Nodemailer and setup smtp with my email provider.

Now Nodemailer is pretty easy to setup and all but, I need to change the code I already wrote for SendGrid and I'm not a fan of that approach so instead I wrote mailer, it's a simple API that you can just hit with a post request and it'll take care of invoking Nodemailer to send the mail.

Now, I don't need to change the sendEmail function, i just need to change it to make a http request to my url instead of SendGrid's api.

The parameters it requires are a base64 string of the email config, a subject for the email , to address and html. Now I could write heavy docs , or I can have a Micro UI that helps you build the post url for it.

You already know I did the 2nd one so no more boring write up.
Mailer
Go ahead check it out, and it might just help people.

Top comments (0)