Bug 439218

Summary: Quoted strings containing comma or brackets are not parsed correctly, causes message sending to fail
Product: [Frameworks and Libraries] kmime Reporter: Jonathan Marten <jjm>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Severity: major CC: montel
Priority: NOR    
Version: git   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.18.0

Description Jonathan Marten 2021-06-27 11:54:08 UTC

Address parsing does not seem to properly handle quoted strings which contain a comma or parenthesis characters.  If a KMail message is composed which includes such an address, whether typed or in reply to a message which contains addresses formatted such, there is a diagnostic if immediate sending is in use.  However, if the Send Later agent or Undo Send is enabled, the mail is lost.


1. Configure KMail for immediate sending and compose a message with an address of the form

  "Foo, Bar" <nobody@mailhost>"

where the actual address within <> can be anything.  The comma can be replaced by an open or close parenthesis.

2. Attempt to send the message.  An error message is displayed, "There were problems trying to queue the message for sending: Message has no recipients"

3. Enable Undo Send and send the message again.  Observe that no error message is displayed.

4.  After the Undo Send time, observe that no message has been received for transmission by the SMTP server and that there are messages in the Akonadi stderr log:

akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: KMime::Message: 
 "(message headers and text)"

akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: Using transport ( "SMTP:mailhost" , 1503887163 )
akonadi_sendlater_agent(203452)/org.kde.pim.messagecore MessageCore::StringUtil::splitAddressField: Error in address splitting: parseAddressList returned false!
akonadi_sendlater_agent(203452)/kf.coreaddons Kdelibs4Migration::Kdelibs4Migration: Using KDEHOME as the location of the old config file
akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: QueueJob started.
akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::queueJobResult: QueueJob failed with error "Message has no recipients."


Message is not sent, error messages and log as above.


The address should be accepted and the message sent.


KMime: Git master (5.17.40)
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2


Setting severity to major because data loss will occur if the Send Later agent is in used.

According to RFC 5322 section 3.2.4 "Quoted Strings", a quoted string can contain any printable ASCII character apart from quote and backslash (which can be quoted with "\").
Comment 1 Laurent Montel 2021-08-02 04:51:57 UTC
I confirm it.
Comment 2 Laurent Montel 2021-08-02 11:56:23 UTC
Git commit db37d0b2aad768530af408aeef76277e0c0f0976 by Laurent Montel.
Committed on 02/08/2021 at 11:55.
Pushed by mlaurent into branch 'release/21.08'.

Fix Bug 439218 - Quoted strings containing comma or brackets are not parsed correctly, causes message sending to fail
FIXED-IN: 5.18.0

M  +3    -1    messagecomposer/src/helper/messagehelper.cpp