Error: " can not connect to any SMTP server"
See original GitHub issueExpected Behavior
Using your package to send mails, the server was unable to send anything. Here’s the server code I used:
var sendmail = require('sendmail')({
logger: {
debug: console.log,
info: console.info,
warn: console.warn,
error: console.error
},
silent: false
})
sendmail({
from: 'no-reply@yourdomain.com',
to: 'thomas@lucidweb.io',
subject: 'test sendmail',
html: 'Mail of test sendmail ',
}, function(err, reply) {
console.log(err && err.stack);
console.dir(reply);
});
And here’s the console error I got:
mx resolved: [ { exchange: 'alt3.aspmx.l.google.com', priority: 10 },
{ exchange: 'alt4.aspmx.l.google.com', priority: 10 },
{ exchange: 'alt1.aspmx.l.google.com', priority: 5 },
{ exchange: 'alt2.aspmx.l.google.com', priority: 5 },
{ exchange: 'aspmx.l.google.com', priority: 1 } ]
Error on connectMx for: { exchange: 'alt3.aspmx.l.google.com', priority: 10 } { [Error: connect ETIMEDOUT 74.125.23.27:25]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '74.125.23.27',
port: 25 }
Error on connectMx for: { exchange: 'alt4.aspmx.l.google.com', priority: 10 } { [Error: connect ETIMEDOUT 173.194.72.27:25]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '173.194.72.27',
port: 25 }
Error on connectMx for: { exchange: 'alt1.aspmx.l.google.com', priority: 5 } { [Error: connect ETIMEDOUT 173.194.73.27:25]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '173.194.73.27',
port: 25 }
Error on connectMx for: { exchange: 'alt2.aspmx.l.google.com', priority: 5 } { [Error: connect ETIMEDOUT 74.125.200.27:25]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '74.125.200.27',
port: 25 }
Error on connectMx for: { exchange: 'aspmx.l.google.com', priority: 1 } { [Error: connect ETIMEDOUT 74.125.195.27:25]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '74.125.195.27',
port: 25 }
error on connectMx Error: can not connect to any SMTP server
at tryConnect (D:\My Files\work\www\lucidweb\node_modules\sendmail\sendmail.js:78:49)
at Socket.<anonymous> (D:\My Files\work\www\lucidweb\node_modules\sendmail\sendmail.js:84:15)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
Error: can not connect to any SMTP server
at tryConnect (D:\My Files\work\www\lucidweb\node_modules\sendmail\sendmail.js:78:49)
at Socket.<anonymous> (D:\My Files\work\www\lucidweb\node_modules\sendmail\sendmail.js:84:15)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
undefined
Context
I’m trying to send a mail with informations received from a form
Your Environment
Windows 10 NodeJS v4.4.3
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unable Send Email due to errors 'Cannot connect to SMTP ...
The 4.4.1 SMTP Status appears when no answer is received from the host or when the connection is lost. This could be due...
Read more >"Smtp error: Failed to connect to server" - Causes and Fixes
1. SMTP restrictions on the server. Servers restrict the programs that can directly connect to remote servers and send mail. · 2. Firewall ......
Read more >How to solve the “SMTP Error: Failed to connect to server” Error?
1. SMTP restrictions on the server. Servers impose restrictions on the programs that can connect directly with remote servers and send an email....
Read more >[Solution] SMTP error: failed to connect to server - Courier
Solution - Here's How To Resolve It · Ensure that the email server does not have any restrictions that may prevent a client...
Read more >Cannot send emails: How to fix email sending issues
Check your internet connection. Yup. · Check your SMTP server details. · Verify all usernames and passwords. · Check your SMTP server connection....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve had the same sort of problem, but it was resolved the moment I send a mail from the domain the app was installed on. E.g. I have a Digital Ocean droplet with the domain geex.company on it and mails are sent without any problem, but the moment I try to send a mail from a domain that is not pointed by DNS to that VPS, like “outlook.com”, it gets blocked by gmail servers and other services list it as “spam”.
I am using node mailer with SendGrid
I was stuck not being able to send out to port 25 locally. SendGrid allows port 2525 so I tried that and worked! Apparently, my ISP does not block port 2525 so I can do local development easily.