-1

I get an issue using SENDMAIL on Ubuntu.

All emails are going into the SPAM folder. I'm using NodeJS and the Nodemailer module.

My code :

var transporter = nodemailer.createTransport({
  sendmail: true,
  newline: 'unix',
  path: '/usr/sbin/sendmail'
});
transporter.sendMail({
  from: "[email protected]",
  to: "[email protected]",
  subject: "test",
  html: "test"
});
1
  • How is your email being sent? Directly from your server or via a smarthost? If you're sending specifically to Gmail are you using authentication? Aug 31, 2018 at 11:10

2 Answers 2

5

If you're sending with a gmail address but not through gmail's mail system using proper authentication your mail will be considered a spoofing attempt by many mail servers. Best practices for sending mails from a program:

  • Only use sender addresses that you actually control.
  • Only send from a properly configured mail server (static ip, correct forward and reverse DNS) or use a smarthost.

Otherwise your mails are indistinguishable from typical spams sent via hacked servers using fake sender addresses, and you shouldn't be surprised that they are classified as spam.

0
-1

Use SMTP authorization. (and check gmail settings - SMTP should be allowed)


If you are sending via sendmail with a gmail address - so letter will be sent from localhost -> recipient mail server is checking DKIM and SPF: failed,failed. -> So this letter 100% comes to spam.

If you are sending via SMTP - you pass thru through authorization with login and password. The letter is being sent from true gmail server.


The second way is more difficult. Configure SPF and DKIM records (make your 'localhost' as legal sender for gmail)

https://support.google.com/a/answer/33786?hl=en

https://support.google.com/a/answer/174124

2
  • 1
    That wont probably solve the problem per se. Aug 31, 2018 at 9:55
  • @Rui it might, but it depends on whether or not there's a smarthost and all sorts of things that the OP hasn't mentioned. Oleh, can you elaborate, please. Steps and an example would be great. At the moment your answer doesn't really solve the problem as described - it's just a vague pointer to a possible solution. Aug 31, 2018 at 11:07

Not the answer you're looking for? Browse other questions tagged .