Commit 4aa91c64 authored by Laurent Montel's avatar Laurent Montel 😁

Fix Bug 429224 - Enabling undo send results in empty return path breaking DKIM

FIXED-IN: 5.16.0
BUG: 429224
parent 9538a303
Pipeline #41386 failed with stage
in 3 minutes and 1 second
......@@ -970,13 +970,7 @@ void ComposerViewBase::queueMessage(const KMime::Message::Ptr &message, MessageC
MessageCore::StringUtil::removePrivateHeaderFields(message, false);
QMapIterator<QByteArray, QString> customHeader(m_customHeader);
while (customHeader.hasNext()) {
customHeader.next();
auto header = new KMime::Headers::Generic(customHeader.key().constData());
header->fromUnicodeString(customHeader.value(), "utf-8");
message->setHeader(header);
}
addCustomHeaders(message);
message->assemble();
connect(qjob, &MailTransport::MessageQueueJob::result, this, &ComposerViewBase::slotQueueResult);
m_pendingQueueJobs++;
......@@ -1237,6 +1231,17 @@ void ComposerViewBase::writeAutoSaveToDisk(const KMime::Message::Ptr &message)
message->clear();
}
void ComposerViewBase::addCustomHeaders(const KMime::Message::Ptr &message)
{
QMapIterator<QByteArray, QString> customHeader(m_customHeader);
while (customHeader.hasNext()) {
customHeader.next();
auto header = new KMime::Headers::Generic(customHeader.key().constData());
header->fromUnicodeString(customHeader.value(), "utf-8");
message->setHeader(header);
}
}
void ComposerViewBase::saveMessage(const KMime::Message::Ptr &message, MessageComposer::MessageSender::SaveIn saveIn)
{
Akonadi::Collection target;
......@@ -1250,6 +1255,7 @@ void ComposerViewBase::saveMessage(const KMime::Message::Ptr &message, MessageCo
}
}
}
addCustomHeaders(message);
message->assemble();
......
......@@ -311,6 +311,7 @@ private:
void initAutoSave();
void addFollowupReminder(const QString &messageId);
void addSendLaterItem(const Akonadi::Item &item);
void addCustomHeaders(const KMime::Message::Ptr &message);
KMime::Message::Ptr m_msg;
MessageComposer::AttachmentControllerBase *m_attachmentController = nullptr;
......
......@@ -23,7 +23,7 @@
#include <MessageCore/StringUtil>
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
#include <KEmailAddress>
using namespace KMime::Types;
using namespace KPIM;
using namespace MailTransport;
......@@ -168,6 +168,7 @@ void AkonadiSender::sendOrQueueMessage(const KMime::Message::Ptr &message, Messa
qCDebug(MESSAGECOMPOSER_LOG) << " No transport defined. Need to create it";
return;
}
if ((method == MessageComposer::MessageSender::SendImmediate) && !MessageComposer::Util::sendMailDispatcherIsOnline()) {
return;
}
......@@ -189,6 +190,13 @@ void AkonadiSender::sendOrQueueMessage(const KMime::Message::Ptr &message, Messa
qjob->addressAttribute().setCc(cc);
qjob->addressAttribute().setBcc(bcc);
if (transport && transport->specifySenderOverwriteAddress()) {
qjob->addressAttribute().setFrom(KEmailAddress::extractEmailAddress(KEmailAddress::normalizeAddressesAndEncodeIdn(transport->senderOverwriteAddress())));
} else {
qjob->addressAttribute().setFrom(KEmailAddress::extractEmailAddress(KEmailAddress::normalizeAddressesAndEncodeIdn(message->from()->asUnicodeString())));
}
MessageComposer::Util::addSendReplyForwardAction(message, qjob);
MessageCore::StringUtil::removePrivateHeaderFields(message, false);
......
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