In my node.js-App, that runs on 1 Heroku worker, needs to send out emails from time to time. The logic is the following:
var transporter = Email.createTransport({
service: 'yahoo',
auth: {
user: process.env.CRAWLER_MAIL,
pass: process.env.CRAWLER_PWD
}
});
transporter.sendMail({
from: process.env.CRAWLER_MAIL,
to: process.env.CRAWLER_RCVR_MAIL,
subject: 'subject',
text: 'text'
}, function(err, result) {
if (err !== null) {
console.log(err);
} else {
...
}
});
I tested this with foreman start and it worked fine. Nonetheless, once deployed to Heroku, the transporter always emits an error with status code '564 : We were unable to deliver your message. Please try resending your message by adding some text.'
process.env. hold the correct values, I checked for that, and text is always a string.
What could be wrong?
I was not able to replicate your problem using my account details.
Could it be related to the sender/recipient emails? Are they both @yahoo.com addresses? There has been some chatter in forums about yahoo groups emails specifically not working and giving that error. Something to do with Yahoo changing their DMARC policy recently.
Nodemailer loads predefined "well known" services from submodule nodemailer-wellknown
This is the current definition loaded when using service: 'yahoo' in your createTransport():
https://github.com/andris9/nodemailer-wellknown/blob/master/services.json#L160
A few thing worth trying:
plus.smtp.mail.yahoo.com.@yahoo.comWe use Mandrill for SMTP on Heroku with our Nodemailer app.
Very reliable and the first 12k emails sent per month are free!
Can you try using it without the service option and specifying the SMTP sever manually as shown below.
var transporter = Email.createTransport(smtpTransport({
host: 'smtp.mail.yahoo.com',
port: 465,
auth: {
user: process.env.CRAWLER_MAIL,
pass: process.env.CRAWLER_PWD
}
}));
I had this problem some time ago and was solved when I bypassed the service
Try this code :
I know it looks same but there are small changes that might solve your problem. Give it a try as it worked fine with foreman start and do let me know if it did any good...
var nodemailer = require('nodemailer');
var transporter = Email.createTransport({
service: 'yahoo',
auth: {
user: 'process.env.CRAWLER_MAIL',
pass: 'process.env.CRAWLER_PWD'
}
});
transporter.sendMail({
from: 'process.env.CRAWLER_MAIL',
to: 'process.env.CRAWLER_RCVR_MAIL',
subject: 'subject',
text: 'text'
});