leonardloo
leonardloo

Reputation: 1803

Nodemailer direct transport blocked by recipient email

I'm using nodemailer, and a direct transport to send an email. The email is successfully sent, but blocked intermittently by the recipient's firewall and never ended up in the recipient email inbox.

Here's my code that sends the nodemailer email:

var nodemailer = require('nodemailer'),
var transport = nodemailer.createTransport(sendmail());
var mailOptions = {
    to: '[email protected]',
    from: 'Sender <[email protected]>',
    subject: 'Subject',
    html: 'html'
};
transport.sendMail(mailOptions, function(err, info) {});

When I change my to to a @gmail.com email, my mail was sent through. I'm not sure how the recipient firewall is configured, but is there a way for me to increase the chances of my email making it across?

Note that blah.com, the from email domain that I'm sending out from is not actually a registered domain. I hosted my server on localhost. Could hosting on AWS, registering the domain blah.com and adding in MX records somehow increase the chances of my email being sent through?

Upvotes: 0

Views: 1596

Answers (1)

Kalana Demel
Kalana Demel

Reputation: 3266

This is what usually happens when a mail is been sent from a domain like blah.com,

  1. Mail Sent
  2. "to address" smtp server gets the mail
  3. it checks the spf record of blah.com and dkim signature of mail
  4. If blah.com dns contain spf record allowing you to send behalf of that domain you pass the first test.
  5. If your mail is signed properly with dkim you pass the second test
  6. Then the smtp server checks if your sending ip has been blacklisted for spamming, if not you pass the third and final test.
  7. If all mail params are in orders then it forwards the mail to the recipient.

What happens in your case is that step 3 is not setup, therefore you cannot successfully send the mail. It would be a lot easier to use a 3rd party service to send mail because they pretty much hold your hand through the entire process and sign all the messages for you.

So you either need to implement these standards yourself or need to use a third party to increase your deliverability.

Upvotes: 1

Related Questions