@ -97,6 +97,13 @@ Smtp::Smtp(QObject *parent)
, m_useSsl ( false )
, m_useSsl ( false )
, m_authType ( AuthPlain )
, m_authType ( AuthPlain )
{
{
static bool needToRegisterMetaType = true ;
if ( needToRegisterMetaType ) {
qRegisterMetaType < QAbstractSocket : : SocketError > ( ) ;
needToRegisterMetaType = false ;
}
# ifndef QT_NO_OPENSSL
# ifndef QT_NO_OPENSSL
m_socket = new QSslSocket ( this ) ;
m_socket = new QSslSocket ( this ) ;
# else
# else
@ -105,6 +112,7 @@ Smtp::Smtp(QObject *parent)
connect ( m_socket , SIGNAL ( readyRead ( ) ) , SLOT ( readyRead ( ) ) ) ;
connect ( m_socket , SIGNAL ( readyRead ( ) ) , SLOT ( readyRead ( ) ) ) ;
connect ( m_socket , SIGNAL ( disconnected ( ) ) , SLOT ( deleteLater ( ) ) ) ;
connect ( m_socket , SIGNAL ( disconnected ( ) ) , SLOT ( deleteLater ( ) ) ) ;
connect ( m_socket , SIGNAL ( error ( QAbstractSocket : : SocketError ) ) , SLOT ( error ( QAbstractSocket : : SocketError ) ) ) ;
// Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html)
// Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html)
Q_ASSERT ( hmacMD5 ( " Jefe " , " what do ya want for nothing? " ) . toHex ( )
Q_ASSERT ( hmacMD5 ( " Jefe " , " what do ya want for nothing? " ) . toHex ( )
@ -525,3 +533,11 @@ QString Smtp::getCurrentDateTime() const
QString ret = weekDayStr + " , " + dayStr + " " + monthStr + " " + yearStr + " " + timeStr + " " + timeOffsetStr ;
QString ret = weekDayStr + " , " + dayStr + " " + monthStr + " " + yearStr + " " + timeStr + " " + timeOffsetStr ;
return ret ;
return ret ;
}
}
void Smtp : : error ( QAbstractSocket : : SocketError socketError )
{
// Getting a remote host closed error is apparently normal, even when successfully sending
// an email
if ( socketError ! = QAbstractSocket : : RemoteHostClosedError )
logError ( m_socket - > errorString ( ) ) ;
}