[PATCH] encode mail address when passing via KApplication::invokeMailer
Ingo Klöcker
kloecker at kde.org
Sat Jan 8 14:45:06 GMT 2005
On Friday 07 January 2005 16:40, Tobias Koenig wrote:
> Hi,
>
> when you pass an email address with non-latin1 characters in the name
> to invokeMailer, in KMail you'll end up with '??????'.
>
> The problem is, that the name is given on the command line to kmail
> in latin1. To fix this, the attached patch encodes the name according
> to RFC2047, which can be read by KMail without problems. Ok to
> commit?
[snip]
> + QStringList tos = QStringList::split( ',', _to );
This does already break for the simple email address
"User, Joe" <joe.user at kde.org>
So please NEVER try to split a list of email addresses with a
QStringList::split( ',', foo ).
The attached patch fixes the problem correctly by encoding the whole to,
cc and bcc address lists in one RFC2047-like encoded blob. Technically
this isn't correct, but without a full RFC2822-compliant parser for
email addresses a better solution isn't possible. Since this hack is
only used when KMail is invoked and KMail decodes the blob correctly
this hack is IMO acceptable for now.
While improving Tobias patch I also fixed the code which builds the
mailto: url. Splitting the comma separated lists of email addresses
isn't necessary (according to RFC 2368 - The mailto URL scheme),
neither for the path (where the To addresses are put) nor for the
queries. Moreover, I thought it might be useful to actually specify the
protocol of the URL. Or does KURL automagically guess the right
protocol? Even if the path is empty?
Anyway, I've ported the patch to kdelibs 3_3 (which I'm still using) and
I've tested it with KMail and a testscript (as kmail replacement)
sending a message to a contact from KAddressBook and clicking on a
mailto: link (with cc and bcc query).
Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.4-kdelibs-kdecore-fix_invokeMailer.diff
Type: text/x-diff
Size: 4394 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050108/7abf0654/attachment.diff>
More information about the kde-core-devel
mailing list