From 4bfc5253c2a560f4c812054ee329d8c15d1221da Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 2 Jul 2018 11:19:30 +0200 Subject: Generate a globally unique message-id that doesn't leak the hostname. --- framework/src/domain/mime/mailtemplates.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/framework/src/domain/mime/mailtemplates.cpp b/framework/src/domain/mime/mailtemplates.cpp index 2c9f6523..c4558562 100644 --- a/framework/src/domain/mime/mailtemplates.cpp +++ b/framework/src/domain/mime/mailtemplates.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -1022,12 +1022,9 @@ KMime::Message::Ptr MailTemplates::createMessage(KMime::Message::Ptr existingMes mail->subject(true)->fromUnicodeString(subject, "utf-8"); if (!mail->messageID(false)) { - auto fqdn = QUrl::toAce(QHostInfo::localHostName()); - if (fqdn.isEmpty()) { - qWarning() << "Unable to generate a Message-ID, falling back to 'localhost.localdomain'."; - fqdn = "local.domain"; - } - mail->messageID(true)->generate(fqdn); + //A globally unique messageId that doesn't leak the local hostname + const auto messageId = "<" + QUuid::createUuid().toString().mid(1, 36).remove('-') + "@kube>"; + mail->messageID(true)->fromUnicodeString(messageId, "utf-8"); } if (!mail->date(true)->dateTime().isValid()) { mail->date(true)->setDateTime(QDateTime::currentDateTimeUtc()); -- cgit v1.2.3