Bug 355883 - Comma in Sender name causes e-mail to be sent without from header
Summary: Comma in Sender name causes e-mail to be sent without from header
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: Git (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-25 10:16 UTC by Andre Heinecke
Modified: 2018-01-31 16:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Hack against KDE 4.14 to avoid this (1.51 KB, patch)
2015-11-25 11:18 UTC, Andre Heinecke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Heinecke 2015-11-25 10:16:41 UTC
When a comma is part of the name the message is sent without a from header. The from might be added during transport but at least in the Sent mails folder the from header is not part of the mail.

German users especially might use a name like: <last name>, <first name>

Noticed with Kdepim 4.14 but I've also tested with master rev. 24dc40872fa1af73354f8b8283d77d028df243b3 

Reproducible: Always

Steps to Reproduce:
1. Either create an identity that has a name with a comma or change the From directly in the messagecomposer.
For example change the From:
Andre Heinecke <aheinecke@intevation.de>
To:
Andre, Heinecke <aheinecke@intevation.de>

2. Send the mail
3. Look at the sent mails folder. Mail does not have a from header.

Actual Results:  
Mails do not have a from header.

Expected Results:  
Should be parsed correctly.

In kdepim 4.14 I've tracked this down to:

composerviewerbase.cpp: MessageComposer::ComposerViewBase::fillQueueJobHeaders

And the line:
 qjob->addressAttribute().setFrom( KPIMUtils::extractEmailAddress( KPIMUtils::normalizeAddressesAndEncodeIdn( infoPart->from() ) ) );

According to added debug output
infoPart->from()  is: Andre, Heinecke <andre.heinecke@intevation.de>
The extract / normalize call returns an empty string.

Debug output from kpimutils (also 4.14):
kontact(4031)/kdepimlibs (kpimutils) KPIMUtils::extractEmailAddress: Input: "Andre, Heinecke <andre.heinecke@intevation.de>" 
Error: "The email address you have entered is not valid because it contains an unexpected comma."
Comment 1 Andre Heinecke 2015-11-25 11:18:51 UTC
Created attachment 95727 [details]
Hack against KDE 4.14 to avoid this

I've used this hack to solve this problem for us in 4.14. (I see it as a hack and so I'm attaching the patch here instead of a review request)

For a proper fix either a different KPIMUtils API should be offered to normalize a single address (and so escape /quote commas) or where the From address is set from the identity it should be ensured that the name is quoted if necessary.

And manually entered addresses in the messagecomposer should bring up a warning.

The advantage of my hack is that it also works for manually changed addresses.
Comment 2 Denis Kurz 2017-06-23 20:17:00 UTC
This bug has never been confirmed for a Kontact version that is based on KDE Frameworks, except possibly a Technology Preview version 5.0.x. Those versions differ significantly from the old 4.x series. Therefore, I plan to close it in around two or three months. In the meantime, it is set to WAITINGFORINFO to give reporters the opportunity to check if it is still valid. As soon as someone confirms it for a recent version (at least 5.1, ideally even more recent), I'll gladly reopen it.

Please understand that we lack the manpower to triage bugs reported for versions almost two years beyond their end of life.
Comment 3 Denis Kurz 2018-01-31 16:52:54 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.1 aka 15.12, preferably more recent), please open a new one unless it already exists. Thank you for all your input.