I am having an issue with Nodemailer on Heroku and I would really appreciate your help.
A previous version of my application used to work on Heroku with no problem and w
I'm working with meteor on an ubuntu install and I was getting similar errors after upgrading to Node.js v12.0 and installing Meteor's accounts-password module.
Turned out, since Meteor has not yet begun development on compatibility with Node.js v12.0, the new binaries installed with Node on my server were not compatible with the binaries bundled with my deployment so I was getting similar errors. In this case, the problem was not with Nodemailer but with simplesmtp.
As suggested here, the solution was to remove the bundled version and use npm to install a server-local version.
So in my deployment script, I added the following lines after I built the bundle.
cd bundle/programs/server/
sudo rm -R ./npm/npm-bcrypt/node_modules/bcrypt
sudo npm install bcrypt
sudo rm -R ./npm/email/node_modules/simplesmtp
sudo npm install simplesmtp
This is easier than modifying the source, especially if you have a scripted deployment.
I just got the following response back from Nodemailer:
You are probably running Nodemailer in iojs. Only the latest version of Nodemailer is suported in node 0.12 and iojs, so you should either upgrade or fix the line 918 yourself like this:
if(this._xoauth2){
this._xoauth2.reconnectCount = 0;
}
Setting properties to boolean values was allowed in ES5 but iojs runs ES6 and trying to set a property in ES6 strict mode throws an error.
I think I have fixed this by by explicitly setting the node.js version in my package file to an older version that uses ES5.
This has fixed my problem. Lesson learned is to always set the nodejs version in the package file otherwise Heroku uses the latest version and it may be incompatible with your modules.
Many thanks to Nodemailer, they got back to me super quick with a great response.
Hopefully this will help someone else.
Thanks.