Forward port of:

SVN commit 490568 by tilladam:

Implement a non-gui-exposed option to allow sending of MDN messages with
an SMTP MAIL FROM of <>, which conforms to the rfc, but doesn't work
with many real world servers, since they discard such messages for spam
protection. Still, integrators might want to set it, via Kiosk, for
example.

svn path=/branches/KDE/3.5/kdepim/; revision=490571
wilder-work
Till Adam 21 years ago
parent 4daf919280
commit cb85660b42
  1. 8
      kmail.kcfg
  2. 30
      kmsender.cpp

@ -443,4 +443,12 @@
</entry>
</group>
<group name="MDN">
<entry name="SendMDNsWithEmptySender" type="Bool">
<default>false</default>
<label>Send Message Disposition Notifications with an empty sender.</label>
<whatsthis>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.</whatsthis>
</entry>
</group>
</kcfg>

@ -25,6 +25,7 @@ using namespace KMime::Types;
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "globalsettings.h"
#include "kmfiltermgr.h"
#include "kcursorsaver.h"
@ -40,6 +41,8 @@ using namespace KMime::Types;
#include "protocols.h"
#include "kmcommands.h"
#include <mimelib/mediatyp.h>
#include <mimelib/enum.h>
#include <mimelib/param.h>
#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 )

Loading…
Cancel
Save