wilt/09.05.2017

For today’s What I have Learned Today. It’ll be about Nodemailer.

There are actually tons of packages in npm (node package manager) that has the same features by sending emails. However for today, I’ve used the package called nodemailer which was chosen by our Tech Lead.

I was not familiar about nodemailer because it was not the package that I’ve used on my previous project that has also the features to send emails to somebody for a specific action.

At first, I’m having an error that says

Error: transporter method not defined.

And it drives me crazy, at first I was checking my code if there was any errors however there’s no compilation error that leads me to the second troubleshooting about errors which was to their documentation. My implemented solution is the same as theirs but with a little twist because of the rendering of the email whereas were using the template engine pug/jade with our email templates. Pug/Jade syntax/templating is pretty dope. However some may find it confusing sometimes and if you’re not used to it you’re pretty doomed if you won’t read their documentation. Moving on, after checking their docs and that didn’t help. Last step was to search before asking, there were some people that encountered the error and I’ve read all the stackoverflows thread that relates to the problem and implement it but still get the same error. I spent about 2 hours I think for that error when I try to check in the package.json if the nodemailer is actually existing in the packages.

And that was the magical moment, it doesn’t exist! That leads me to install it and put it there. I wasted about 2 hours just for that stupidity.

The best thing about using nodemailer is that you can spit it out to the console what is the response either status/error codes or even the response from the mailing server of your choice so you won’t be wondering about what is happening to the mail, where is it bla bla.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.