Caught SmtpClient::SendMessageTimeoutException

In Smtp::quit, SmtpClient::SendMessageTimeoutException is caught and if still connected to the smtp server, manually close
the connection.
This commit is contained in:
Ezenwanne I. Cosmas 2017-01-13 18:49:02 +01:00 committed by GitHub
parent ef6194fb26
commit ff2eb297c4

View File

@ -420,7 +420,16 @@ bool SmtpClient::sendMail(MimeMessage& email)
void SmtpClient::quit() void SmtpClient::quit()
{ {
try
{
sendMessage("QUIT"); sendMessage("QUIT");
}
catch(SmtpClient::SendMessageTimeoutException)
{
//Manually close the connection to the smtp server if message "QUIT" wasn't received by the smtp server
if(socket->state() == QAbstractSocket::ConnectedState || socket->state() == QAbstractSocket::ConnectingState || socket->state() == QAbstractSocket::HostLookupState)
socket->disconnectFromHost();
}
} }
/* [3] --- */ /* [3] --- */