summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore 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
@@ -101,53 +101,53 @@ void SmtpHandler::readyRead()
101 _state = ReadAuth; 101 _state = ReadAuth;
102 } 102 }
103 } else if (_state == ReadAuth && responseCode == 334) { 103 } else if (_state == ReadAuth && responseCode == 334) {
104 QString msgId = MiscFunctions::decodeBase64(response); 104 QString msgId = MiscFunctions::decodeBase64(response);
105 105
106 QString authString; 106 QString authString;
107 authString = _account.user() + " " + 107 authString = _account.user() + " " +
108 MiscFunctions::smtpAuthCramMd5(msgId, _account.pass()); 108 MiscFunctions::smtpAuthCramMd5(msgId, _account.pass());
109 authString = MiscFunctions::encodeBase64(authString); 109 authString = MiscFunctions::encodeBase64(authString);
110 110
111 emit status(tr("SMTP> Authenticating")); 111 emit status(tr("SMTP> Authenticating"));
112 sendToSocket(authString + "\r\n"); 112 sendToSocket(authString + "\r\n");
113 113
114 _state = Mail; 114 _state = Mail;
115 } else if (_state == Helo && responseCode == 220) { 115 } else if (_state == Helo && responseCode == 220) {
116 QString hostname = getenv("HOSTNAME"); 116 QString hostname = getenv("HOSTNAME");
117 if (hostname.stripWhiteSpace().isEmpty()) 117 if (hostname.stripWhiteSpace().isEmpty())
118 hostname = "opiemail"; 118 hostname = "opiemail";
119 119
120 emit status(tr("SMTP> HELO *")); 120 emit status(tr("SMTP> HELO *"));
121 sendToSocket(QString("HELO %1\r\n").arg(hostname)); 121 sendToSocket(QString("HELO %1\r\n").arg(hostname));
122 _state = Mail; 122 _state = Mail;
123 } else if (_state == Mail && responseCode == 250) { 123 } else if (_state == Mail && responseCode == 250) {
124 emit status(tr("SMTP> MAIL FROM: *")); 124 emit status(tr("SMTP> MAIL FROM: *"));
125 sendToSocket("MAIL FROM: " + _account.email() + "\r\n"); 125 sendToSocket("MAIL FROM: <" + _account.email() + ">\r\n");
126 _state = Rcpt; 126 _state = Rcpt;
127 } else if (_state == Rcpt && responseCode == 250) { 127 } else if (_state == Rcpt && responseCode == 250) {
128 emit status(tr("SMTP> RCPT TO: *")); 128 emit status(tr("SMTP> RCPT TO: *"));
129 sendToSocket("RCPT TO: " + _to + "\r\n"); 129 sendToSocket("RCPT TO: <" + _to + ">\r\n");
130 _state = Data; 130 _state = Data;
131 } else if (_state == Data && responseCode == 250) { 131 } else if (_state == Data && responseCode == 250) {
132 emit status(tr("SMTP> DATA")); 132 emit status(tr("SMTP> DATA"));
133 sendToSocket("DATA\r\n"); 133 sendToSocket("DATA\r\n");
134 _state = Body; 134 _state = Body;
135 } else if (_state == Body && responseCode == 354) { 135 } else if (_state == Body && responseCode == 354) {
136 emit status(tr("SMTP> Sending data...")); 136 emit status(tr("SMTP> Sending data..."));
137 sendToSocket(_header + "\r\n" + _message + "\r\n.\r\n", false); 137 sendToSocket(_header + "\r\n" + _message + "\r\n.\r\n", false);
138 _state = Quit; 138 _state = Quit;
139 } else if (_state == Quit) { 139 } else if (_state == Quit) {
140 emit status(tr("SMTP> QUIT (Done)")); 140 emit status(tr("SMTP> QUIT (Done)"));
141 sendToSocket("QUIT\r\n"); 141 sendToSocket("QUIT\r\n");
142 _state = Close; 142 _state = Close;
143 } else if (_state == Close) { 143 } else if (_state == Close) {
144 144
145 } else { 145 } else {
146 emit error(tr("The server returned an error. This is the message:<br>%1").arg(response)); 146 emit error(tr("The server returned an error. This is the message:<br>%1").arg(response));
147 stop(); 147 stop();
148 } 148 }
149} 149}
150 150
151void SmtpHandler::sendToSocket(const QString &text, bool log) 151void SmtpHandler::sendToSocket(const QString &text, bool log)
152{ 152{
153 _socket->writeBlock(text.latin1(), text.length()); 153 _socket->writeBlock(text.latin1(), text.length());