nodemailer / smtp-server

Create custom SMTP servers on the fly
Other
846 stars 145 forks source link

Can't receive email from Microsoft #112

Open binary64 opened 6 years ago

binary64 commented 6 years ago

Hi so I have smtp-server running on port 25. It receives email sent from gmail.com just fine (well, there is a 60 second delay, presumably gmail is trying TLS first, and it times out, then it tries 25).

However, emails sent from Microsoft/Hotmail do not come through at all.

I'm wondering how to set up TLS on port 587 or something, so I can receive from Microsoft.

I saw you have sniOptions but the documentation doesn't describe its contents. Is there any possibility of a small example showing how to host a secure smtp server?

Many thanks! Excellent project

Shadowfox38 commented 4 years ago

Hi @binary64 , i am also trying to set up a smtp server which recieves emails ( using smtp-server module ), but i cant recieve emails. I turned the logger on, and it keeps showing mei Error : socket closed unexpectedly I am attaching my code, please tell me if you did anything different

Note - i am using port 9000 because i have setup port forwading in my router (to forward incoming 25 requests to 9000 )

SMTPserver.txt

dextermb commented 3 years ago

Hey @binary64 @Shadowfox38,

Did you guys manage to resolve your issues with Microsoft? I have a secure smtp-server instance, and I'm trying to add my email address to Outlook, but I get the following error:

Error: Socket closed unexpectedly
    at TLSSocket.onError (/usr/src/app/node_modules/smtp-server/lib/smtp-server.js:457:29)
    at Object.onceWrapper (node:events:483:26)
    at TLSSocket.emit (node:events:388:22)
    at node:net:661:12
    at Socket.done (node:_tls_wrap:564:7)
    at Object.onceWrapper (node:events:483:26)
    at Socket.emit (node:events:376:20)
    at TCP.<anonymous> (node:net:661:12)

Any direction would be great!

Shadowfox38 commented 3 years ago

Just turn the secure option off :)

Apparently the initial handshake is insecure, and it then upgrades using TLS (I'm not sure about this though)

dextermb commented 3 years ago

Just turn the secure option off :)

Hm. Interesting. I'll give this a go, but I'm not sure how it'd upgrade.

Edit: @shadowfox38 I'm still getting the same issue when secure is not set to true.

dextermb commented 3 years ago

As a follow up Outlook desktop tries to use the server as an IMAP server rather than an SMTP user by going through the "Add account" dialogs.

I used Outlook web and added a CA along with my certificates, selected SMTP only, and it now works flawlessly.

I believe you can add send only accounts on Outlook desktop but it's more hidden

Zonalds commented 2 years ago

Any help with this? Nothing here works for me. I have been struggling without any solutions.

fulvi0 commented 2 years ago

flawlessly

Hi, @dextermb, can you explain a bit more, when you said "added a CA along with..."? do you use an Outlook certificate?

I'm facing the same issues but trying to connect Dynamics CRM with smtp-server; but with others email clients works flawlessly without any issues.

Error: Socket closed unexpectedly
    at TLSSocket.onError (/opt/smtp-signature-relay/node_modules/smtp-server/lib/smtp-server.js:473:29)
    at Object.onceWrapper (events.js:286:20)
    at TLSSocket.emit (events.js:203:15)
    at _handle.close (net.js:607:12)
    at Socket.done (_tls_wrap.js:388:7)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at TCP._handle.close (net.js:607:12)
Emitted 'error' event at:
    at SMTPServer._onError (/opt/smtp-signature-relay/node_modules/smtp-server/lib/smtp-server.js:332:14)
    at _upgrade (/opt/smtp-signature-relay/node_modules/smtp-server/lib/smtp-server.js:72:41)
    at TLSSocket.onError (/opt/smtp-signature-relay/node_modules/smtp-server/lib/smtp-server.js:473:13)
    at Object.onceWrapper (events.js:286:20)
    [... lines matching original stack trace ...]
    at TCP._handle.close (net.js:607:12)
dextermb commented 2 years ago

Hi, @dextermb, can you explain a bit more

@fulvi0 unfortunately this was two years ago and the project I set up is not used anymore.

Have you attempted to add accounts to Outlook via the live.com site to an already existing email account?

wodka commented 11 months ago

for me it is also crashing with mails from microsoft, all other providers are working without problems in the tls handshake.

Error: 38DB7273897F0000:error:0A000076:SSL routines:tls_choose_sigalg:no suitable signature algorithm:../deps/openssl/openssl/ssl/t1_lib.c:3318:

Emitted 'error' event on SMTPServer instance at:
    at SMTPServer._onError (/app/node_modules/smtp-server/lib/smtp-server.js:332:14)
    at SMTPConnection.<anonymous> (/app/node_modules/smtp-server/lib/smtp-server.js:95:44)
    at SMTPConnection.emit (node:events:513:28)
    at SMTPConnection._onError (/app/node_modules/smtp-server/lib/smtp-connection.js:388:14)
    at TLSSocket.<anonymous> (/app/node_modules/smtp-server/lib/smtp-connection.js:1415:52)
    at Object.onceWrapper (node:events:628:26)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._tlsError (node:_tls_wrap:919:8)
    at TLSSocket.emit (node:events:525:35)
    at emitErrorNT (node:internal/streams/destroy:151:8) {
  library: 'SSL routines',
  reason: 'no suitable signature algorithm',
  code: 'ERR_SSL_NO_SUITABLE_SIGNATURE_ALGORITHM',
}
wodka commented 9 months ago

One thing to do, so at least the server is not just crashing:

const server = new SMTPServer({ ... })

// this is the important line to only display the error and not stop the process!
server.on('error', (e) => console.error(e))
charlesmudy commented 1 month ago

I'm getting this quite a lot, any solution @wodka @binary64 ?