diff --git a/kmail.kcfg b/kmail.kcfg
index 1428258fd..3550ecc8a 100644
--- a/kmail.kcfg
+++ b/kmail.kcfg
@@ -443,4 +443,12 @@
+
+
+ false
+
+ Send Message Disposition Notifications with an empty sender string. Some servers might be configure to reject such messages, so if you are experiencing problems sendin MDNs, uncheck this option.
+
+
+
diff --git a/kmsender.cpp b/kmsender.cpp
index 86b97d573..d848c18d2 100644
--- a/kmsender.cpp
+++ b/kmsender.cpp
@@ -25,6 +25,7 @@ using namespace KMime::Types;
#include
#include
#include
+#include "globalsettings.h"
#include "kmfiltermgr.h"
#include "kcursorsaver.h"
@@ -40,6 +41,8 @@ using namespace KMime::Types;
#include "protocols.h"
#include "kmcommands.h"
#include
+#include
+#include
#define SENDER_GROUP "sending mail"
@@ -236,6 +239,28 @@ void KMSender::emitProgressInfo( int currentFileProgress )
mProgressItem->setProgress(percent);
}
+static bool messageIsDispositionNotificationReport( KMMessage *msg )
+{
+ if ( msg->type() == DwMime::kTypeMessage &&
+ msg->subtype() == DwMime::kSubtypeDispositionNotification )
+ return true;
+
+ if ( msg->type() != DwMime::kTypeMultipart ||
+ msg->subtype() != DwMime::kSubtypeReport )
+ return false;
+
+ DwMediaType& ct = msg->dwContentType();
+ DwParameter *param = ct.FirstParameter();
+ while( param ) {
+ if ( !qstricmp( param->Attribute().c_str(), "report-type")
+ && !qstricmp( param->Value().c_str(), "disposition-notification" ) )
+ return true;
+ else
+ param = param->Next();
+ }
+ return false;
+}
+
//-----------------------------------------------------------------------------
void KMSender::doSendMsg()
{
@@ -559,6 +584,11 @@ void KMSender::doSendMsgAux()
QStringList to, cc, bcc;
QString sender;
extractSenderToCCAndBcc( mCurrentMsg, &sender, &to, &cc, &bcc );
+
+ // MDNs are required to have an empty envelope from as per RFC2298.
+ if ( messageIsDispositionNotificationReport( mCurrentMsg ) && GlobalSettings::self()->sendMDNsWithEmptySender() )
+ sender = "<>";
+
const QCString message = mCurrentMsg->asSendableString();
if ( sender.isEmpty() || !mSendProc->send( sender, to, cc, bcc, message ) ) {
if ( mCurrentMsg )