summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/mail2/libmail/smtphandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/unsupported/mail2/libmail/smtphandler.cpp b/noncore/unsupported/mail2/libmail/smtphandler.cpp
index 1bbad8b..d0a505d 100644
--- a/noncore/unsupported/mail2/libmail/smtphandler.cpp
+++ b/noncore/unsupported/mail2/libmail/smtphandler.cpp
@@ -93,69 +93,69 @@ void SmtpHandler::readyRead()
// FIXME: Dirty, quick hack!
if (!capabilities.grep(QRegExp("^250-AUTH=LOGIN.*CRAM-MD5.*$")).isEmpty()) {
// emit errorOccourred(ErrAuthNotSupported);
_state = Mail;
} else {
emit status(tr("SMTP> AUTH CRAM-MD5"));
sendToSocket("AUTH CRAM-MD5\r\n");
_state = ReadAuth;
}
} else if (_state == ReadAuth && responseCode == 334) {
QString msgId = MiscFunctions::decodeBase64(response);
QString authString;
authString = _account.user() + " " +
MiscFunctions::smtpAuthCramMd5(msgId, _account.pass());
authString = MiscFunctions::encodeBase64(authString);
emit status(tr("SMTP> Authenticating"));
sendToSocket(authString + "\r\n");
_state = Mail;
} else if (_state == Helo && responseCode == 220) {
QString hostname = getenv("HOSTNAME");
if (hostname.stripWhiteSpace().isEmpty())
hostname = "opiemail";
emit status(tr("SMTP> HELO *"));
sendToSocket(QString("HELO %1\r\n").arg(hostname));
_state = Mail;
} else if (_state == Mail && responseCode == 250) {
emit status(tr("SMTP> MAIL FROM: *"));
- sendToSocket("MAIL FROM: " + _account.email() + "\r\n");
+ sendToSocket("MAIL FROM: <" + _account.email() + ">\r\n");
_state = Rcpt;
} else if (_state == Rcpt && responseCode == 250) {
emit status(tr("SMTP> RCPT TO: *"));
- sendToSocket("RCPT TO: " + _to + "\r\n");
+ sendToSocket("RCPT TO: <" + _to + ">\r\n");
_state = Data;
} else if (_state == Data && responseCode == 250) {
emit status(tr("SMTP> DATA"));
sendToSocket("DATA\r\n");
_state = Body;
} else if (_state == Body && responseCode == 354) {
emit status(tr("SMTP> Sending data..."));
sendToSocket(_header + "\r\n" + _message + "\r\n.\r\n", false);
_state = Quit;
} else if (_state == Quit) {
emit status(tr("SMTP> QUIT (Done)"));
sendToSocket("QUIT\r\n");
_state = Close;
} else if (_state == Close) {
} else {
emit error(tr("The server returned an error. This is the message:<br>%1").arg(response));
stop();
}
}
void SmtpHandler::sendToSocket(const QString &text, bool log)
{
_socket->writeBlock(text.latin1(), text.length());
if (log) {
#ifndef QT_NO_DEBUG
qDebug(tr("SMTP < %3").arg(text.stripWhiteSpace()));
#endif
}
}