Summary: | Cannot send to addresses containing an ampersand (&) | ||
---|---|---|---|
Product: | [Unmaintained] kmail | Reporter: | Robert Clark <clark> |
Component: | general | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.9 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Suggested fix from Magnus as applied to kmail/kmsender.cpp on the HEAD branch |
Description
Robert Clark
2005-12-07 19:00:30 UTC
I get the same thing with an address K&H&L@somedomain.nl. According to RFC822, & is not a special character and should be treated exactly as any other alphanumeric character. It looks like kmail treats it specially. Bug still exists in kmail 1.9.1. I was able to confirm that this happens with other smtp servers, not just exchange (tested against mac.com and postfix in my own domain). this bug is still in Kmail 1.9.1 on KDE 3.5.2 (linux) I got the following info from my ISP... lloyd osten wrote: > On Monday 29 May 2006 13:30, you wrote: > >>Hi Lloyd, >> >>Can you forward me the bounce message you are getting when trying >>to send to Losurs. I'll have a look at it, and get back to you >>with what's up. > > > Just as I clicked send on this new message, the following error > appeared: > > Message sending failed since the following recipients were rejected by > the server q (The server responded "5.1.1 <q>...user unknown" > Hi Lloyd, We found this in the logs of our mail server: May 30 06:34:27 mailout1 sendmail[20825]: k4UCYMqf020825: from=<lloyd.osten@accesscomm.ca>, size=348, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=static24-72-63-103.regina.accesscomm.ca [24.72.63.103] May 30 06:34:27 mailout1 sendmail[20825]: k4UCYMqf020825: <q>... User unknown From what we can guess, it would appear that your kmail is doing something weird with the & symbol in q&a@losurs.org. It seems to be stripping everything after the q, so you are left with the above error message. Here's a post that seem to refer to the same problem: http://linux.derkeiler.com/Mailing-Lists/KDE/2006-01/msg00301.html Ultimately, I'd say you file a bug report, or check out another client. The problem is here, in kmsender.cpp: bool KMSendSMTP::doSend( const QString & sender, const QStringList & to, const QStringList & cc, const QStringList & bcc, const QCString & message ) { QString query = "headers=0&from="; query += KURL::encode_string( sender ); if ( !to.empty() ) query += "&to=" + to.join( "&to=" ); if ( !cc.empty() ) query += "&cc=" + cc.join( "&cc=" ); if ( !bcc.empty() ) query += "&bcc=" + bcc.join( "&bcc=" ); The recipients need some KURL::encode_string()-ing too, not just the sender! Is this the shortest replacement? QString query = "headers=0&from="; QStringList::Iterator it; query += KURL::encode_string( sender ); for ( it = to.begin(); it != to.end(); ++it ) query += "&to=" + KURL::encode_string(*it); for ( it = cc.begin(); it != cc.end(); ++it ) query += "&cc=" + KURL::encode_string(*it); for ( it = bcc.begin(); it != bcc.end(); ++it ) query += "&bcc=" + KURL::encode_string(*it); that looks good to me, but this is only based on the code you have put up here. I think I'm going to patch my local version. Created attachment 17234 [details]
Suggested fix from Magnus as applied to kmail/kmsender.cpp on the HEAD branch
SVN commit 571372 by winterz: Fix for the bug "Cannot send to addresses containing an ampersand". Thanks for the patch Magnus and Robert. Approved by Ingo. BUG: 117882 M +12 -10 kmsender.cpp --- branches/KDE/3.5/kdepim/kmail/kmsender.cpp #571371:571372 @@ -173,7 +173,7 @@ } //Ensure the message is correctly and fully parsed - + /* The above was added by Marc and seems to be necessary to ensure * the mail is in a sane state before sending. The unGet makes the * attached unencrypted version of the mail (if there is one ) disappear. @@ -331,10 +331,10 @@ imapSentFolder = kmkernel->imapFolderMgr()->findIdString( mCurrentMsg->fcc() ); } - // No, or no usable sentFolder, and no, or no usable imapSentFolder, + // No, or no usable sentFolder, and no, or no usable imapSentFolder, // let's try the on in the identity if ( ( sentFolder == 0 || sentFolder->isReadOnly() ) - && ( imapSentFolder == 0 || imapSentFolder->isReadOnly() ) + && ( imapSentFolder == 0 || imapSentFolder->isReadOnly() ) && !id.fcc().isEmpty() ) { sentFolder = kmkernel->folderMgr()->findIdString( id.fcc() ); @@ -600,7 +600,7 @@ 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 = "<>"; @@ -1052,13 +1052,15 @@ QString query = "headers=0&from="; query += KURL::encode_string( sender ); - if ( !to.empty() ) - query += "&to=" + to.join( "&to=" ); - if ( !cc.empty() ) - query += "&cc=" + cc.join( "&cc=" ); - if ( !bcc.empty() ) - query += "&bcc=" + bcc.join( "&bcc=" ); + QStringList::ConstIterator it; + for ( it = to.begin(); it != to.end(); ++it ) + query += "&to=" + KURL::encode_string(*it); + for ( it = cc.begin(); it != cc.end(); ++it ) + query += "&cc=" + KURL::encode_string(*it); + for ( it = bcc.begin(); it != bcc.end(); ++it ) + query += "&bcc=" + KURL::encode_string(*it); + KMTransportInfo * ti = mSender->transportInfo(); if ( ti->specifyHostname ) |