nodemailer / smtp-server

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

Monitor whether or not an email is sent securely #124

Closed Redsandro closed 5 years ago

Redsandro commented 5 years ago

I can watch a secure and an insecure port and output a message to the console to see if a request was sent to either of them.

But some servers prefer to use an insecure port (secure: false) and run STARTLS to switch to secure communication. Is there a way for me to monitor when a payload is sent securely, or whether or not STARTTLS was used (successfully)?

andris9 commented 5 years ago

You can get all required info from the logger

[2019-04-18 11:32:35] INFO  SMTP Server listening on [::]:2525
[2019-04-18 11:32:38] INFO  [#zugoxqtbi2tt4xsj] Connection from [::1]
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] S: 220 andris-outfunnel ESMTP Welcome to My Awesome SMTP Server
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] C: EHLO openssl.client.net
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] S: 250-andris-outfunnel Nice to meet you, [::1]
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250-8BITMIME
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250-SMTPUTF8
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250-STARTTLS
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250-SIZE 10485760
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250-XCLIENT NAME ADDR PORT PROTO HELO LOGIN
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] 250 XFORWARD NAME ADDR PORT PROTO HELO IDENT SOURCE
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] C: STARTTLS
[2019-04-18 11:32:38] DEBUG [#zugoxqtbi2tt4xsj] S: 220 Ready to start TLS
[2019-04-18 11:32:38] INFO  [#zugoxqtbi2tt4xsj] Connection upgraded to TLS using  ECDHE-RSA-AES128-GCM-SHA256
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] C: ehlo foo
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] S: 250-andris-outfunnel Nice to meet you, [::1]
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] 250-8BITMIME
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] 250-SMTPUTF8
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] 250-SIZE 10485760
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] 250-XCLIENT NAME ADDR PORT PROTO HELO LOGIN
[2019-04-18 11:32:42] DEBUG [#zugoxqtbi2tt4xsj] 250 XFORWARD NAME ADDR PORT PROTO HELO IDENT SOURCE
Redsandro commented 5 years ago

Thank you.