jordan-wright / email

Robust and flexible email library for Go
MIT License
2.65k stars 321 forks source link

TLS error with email 3 #71

Closed edgesoft closed 4 years ago

edgesoft commented 5 years ago

TLS worked in 2.2 and now I get first record does not look like a TLS handshake

Comes from https://golang.org/src/crypto/tls/conn.go row 635

plainAuth := smtp.PlainAuth("", mail.username, mail.password, mail.host)
if len(mail.username) == 0 {
  plainAuth = nil
}

err = e.SendWithTLS(fmt.Sprintf("%s:%s", mail.host, mail.smtpPort), plainAuth, &tls.Config{InsecureSkipVerify: true})

Any pointers?

edgesoft commented 5 years ago

Reverting the changes in SendWithTLS made it work again.

stefanfransen commented 5 years ago

Having the same issue, any updates?

edgesoft commented 5 years ago

@StefanFransen We had to fork it and go back to prior implementation

AlexBBBril commented 5 years ago

This problem occurs because if you use SMTP, you need to use a simple connection and send the "STARTTLS" signal to the server. This will tell the server includes tls and the to encrypt following packets in the connection.

https://www.limilabs.com/blog/ssl-vs-tls-vs-starttls-stls

wechatshop commented 5 years ago

There is error " 454 Command not permitted when TLS active" when using SendWithTLS with port 465。

vcastellm commented 5 years ago

Any update on this issue? Thanks

SteelPhase commented 5 years ago

I'm running into this issue as well. SendWithTLS might need to be broken up to handle STARTTLS, vs a tls connection. SendWithTLS is definitely not correct in the latest version