Search code examples
node.jsemailauthenticationsmtpgmail

Send email from local smtp server node.js


I'm using node.js smtp-server module to create local smtp server on my localhost.

But when I want to connect to another smpt server (e.g gmail) from my local smtp server it requires authentication. I just want to send email to any gmail account and don't want to login to my gmail account!

Any help?


Solution

  • Your local SMTP server should be able to send email to the Google MX servers without authentication, provided that you are sending email to an address @gmail.com.  To get a list of MX servers you would have to do a DNS lookup on gmail.com for records of type MX.  If you are trying to connect to other Google SMTP servers (other than their listed MX servers) this may not work so be sure to connect to the MX servers.