email
email copied to clipboard
SSL/TLS communication isn't possible when using Pool
I tried to use the the Pool
for sending emails to a SMTP server which offers SSL/TLS connections (not STARTTLS) and the pool.Send
hangs on pool.build
; that doesn't happen with Email.SendWithTLS
because it uses the TLS package to dial the connection.
Hence the pool type cannot send emails using SSL/TLS connections, only send emails on unencrypted connections or encrypted ones through STARTTLS.
On the other hand, in ab implementation of a function which checks SMTP server connections which I've done, I deal differently.
When the server advertise the STARTTLS connection, there is no need to dial a TLS connection, a unencrypted dial (net.Dial
) works and after, it's the client.StartTLS
which upgrades the connection, that's mostly is how the pool works. The thing is that it differs from the implementation of Email.SendWithTLS
function, which always dial the connection with TLS independently if STARTTLS is available or not.
I cannot say if that's an issue or not, because I haven't used the Email.SendWithTLS
of this package, so I'm mostly reporting as an insight.
Pool.Send hangs on pool.build because use (net.Dial) on TLS connection. the pool builder try startTLS after that
Hello, I believe this issue is still present. I hit it with https://github.com/slurdge/goeland/issues/3 and while I can provide a flag to have explicit SSL, I believe it wouldn't work with pools.
I think a fix would be to have the pool have an ExplicitSSL (or ExplicitTLS) member and the dial would be done by the appropriate mechanism in build. Thoughts ?
I'm having the same problem as you, using pool to send emails with :sent error:timed out, sending without pool works fine, I don't think pool is working properly!
@jeefs Can you give me the two config, the one that works and the one that doesn't work ?
@slurdge I've switched to the official package net/stmp to send emails and use ssl support for encrypted emails, no problems so far!
I gave up using pooled connections