xhit / go-simple-mail

Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
MIT License
650 stars 102 forks source link

How to track the low level raw SMTP log? #91

Closed suntong closed 11 months ago

suntong commented 11 months ago

How to track the low raw SMTP log as below to debug?

Connected to smtps://smtp.foo.com:465/
S: 220 dmz-front2.mail.foo.com ESMTP ready
C: EHLO [10.100.40.55]
S: 250-dmz-front2.mail.foo.com
S: 250 AUTH PLAIN LOGIN
C: AUTH PLAIN [base64 user+pass]
S: 235 2.0.0 OK
C: MAIL FROM:<from@foo.com>
S: 250 2.1.0 Ok
C: RCPT TO:<to@bar.com>
S: 250 2.1.5 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: csmbp1@foo.com
C: To: to@bar.com
C: Subject: [test]
C: Date: Fri, 18 Oct 2019 11:33:35 +0800
C: MIME-Version: 1.0
C: Content-Type: text/plain; charset=utf-8
C: Content-Transfer-Encoding: base64
C: 
C: [some body]
C: .
S: 250 2.0.0 Ok: queued as ,,,,,,,,
xhit commented 11 months ago

Currently not log, but it's possible to implement it.

I will try to spend sometime on this.

Thanks.

suntong commented 11 months ago

Oh, I just found one that can do it right out of the box -- https://github.com/wneessen/go-mail/.

thanks anyway.