0

What I'm trying to do is send emails through the nodemailer library. I believe that the problem is time to configure the host. I tried using gmail and it works perfectly, but when I use my own email provider and it returns this error below.

User authentication failedError: getaddrinfo ENOTFOUND http://myserver.com"

module.exports = {
    host: 'http://myserver.com',
    port: '587',
    user: 'email@myserver.com',
    pass: 'mypassword'
}
RoktSe
  • 419
  • 1
  • 4
  • 22

2 Answers2

1

You need to delete the protocol http:// from host variable. You trying to do dns request to http://myserver.com, not myserver.com.

Also, the mail services use not http protocol, but smtp (smtps for secure connections).

Another way: you can use one-line connection string

let transporter = nodemailer.createTransport(
`smtp://email:mypassword@myserver.com:587`);
Danr0
  • 11
  • 1
0

The server you've listed isn't a valid domain - i.e if I run a DNS lookup it won't resolve to anything.

This suggests to me that you are trying to connect to a mail server on your local network and have changed the DNS in your router or your machine's hosts file to map a local IP to a named domain. If this is the case I'd suggest getting the actual IP address of your local mail server and use this instead and see if this helps connectivity.