The connection deadline is only set after smtpNewClient was called. Since smtpNewClient already wants to read 220 from the connection, a server that does not respond will result in a hanging connection.
This issue should be resolvable by moving the deadline code just after creation of the connection.
The connection deadline is only set after
smtpNewClient
was called. SincesmtpNewClient
already wants to read220
from the connection, a server that does not respond will result in a hanging connection.This issue should be resolvable by moving the deadline code just after creation of the connection.