-1

How can i send mail from node js with the use of my domail mail like as : [email protected]

The connection setting was below using nodemailer

const transporter = nodemailer.createTransport({ host: 'https://example.com', port: 465, // Port secure: true, // this is true as port is 465 auth: { user: '[email protected]', pass: 'mypassword' } }); 

If i send mail there is an error like below

Error: getaddrinfo ENOTFOUND https://example.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) { errno: -3008, code: 'EDNS', syscall: 'getaddrinfo', hostname: 'https://example.com', command: 'CONN' } 
0

2 Answers 2

2

I had this issue when I accedentally added a trailing space to the hostname. The problem seems to be the failing DNS lookup.

In your example: The https:// part is not part of the hostname. In fact, you use SMTP protocol, not https.

try

const transporter = nodemailer.createTransport({ host: 'example.com', // Whatever your true hostname is. Could also be smtp.example.com or similar. port: 465, // Port secure: true, // this is true as port is 465 auth: { user: '[email protected]', pass: 'mypassword' } }); 
Sign up to request clarification or add additional context in comments.

Comments

0

I think the problem might come from your SMTP. check your configuration correct or wrong by using (outlook or google mail).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.