Commit 93cd12c1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Check if server support dsn before to force it

parent 5c769fcf
Pipeline #163600 passed with stages
in 1 minute and 44 seconds
......@@ -170,7 +170,9 @@ void SendJob::handleResponse(const ServerResponse &r)
void SendJobPrivate::sendNextRecipient()
{
q->sendCommand("RCPT TO:<" + m_recipientsCopy.takeFirst().toUtf8() + '>' + (m_dsn ? " NOTIFY=success,failure" : ""));
const bool dnsSupport = m_session->allowsDns() ? m_dsn : false;
// qDebug() << " void SendJobPrivate::sendNextRecipient()" << m_session->allowsDns() << " dnsSupport " << dnsSupport;
q->sendCommand("RCPT TO:<" + m_recipientsCopy.takeFirst().toUtf8() + '>' + (dnsSupport ? " NOTIFY=success,failure" : ""));
}
void SendJobPrivate::addRecipients(const QStringList &rcpts)
......
......@@ -149,6 +149,11 @@ bool Session::allowsTls() const
return d->m_allowsTls;
}
bool Session::allowsDns() const
{
return d->m_allowsDns;
}
QStringList Session::availableAuthModes() const
{
return d->m_authModes;
......@@ -253,6 +258,8 @@ void SessionPrivate::responseReceived(const ServerResponse &r)
m_allowsTls = true;
} else if (r.text().startsWith("AUTH ")) { // krazy:exclude=strings
setAuthenticationMethods(r.text().remove(0, QByteArray("AUTH ").count()).split(' '));
} else if (r.text() == "DSN") {
m_allowsDns = true;
}
if (!r.isMultiline()) {
......
......@@ -93,6 +93,11 @@ public:
*/
Q_REQUIRED_RESULT bool allowsTls() const;
/**
Returns true if the SMTP server has indicated that it allows DSN support, false otherwise.
*/
Q_REQUIRED_RESULT bool allowsDns() const;
/**
@todo: return parsed auth modes, instead of strings.
*/
......
......@@ -84,6 +84,7 @@ private:
int m_size = 0;
bool m_allowsTls = false;
bool m_starttlsSent = false;
bool m_allowsDns = false;
QStringList m_authModes;
QString m_customHostname;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment