Bug 2210 - Display name with invalid addresses not quoted when inserted from address book
Summary: Display name with invalid addresses not quoted when inserted from address book
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: UI/Address Book (show other bugs)
Version: 3.7.6
Hardware: PC Linux
: P3 minor
Assignee: users
URL:
: 2010 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-21 07:02 UTC by Martin Schwenke
Modified: 2013-11-05 01:17 UTC (History)
1 user (show)

See Also:


Attachments
Fix proposal (2.06 KB, patch)
2013-10-23 16:55 UTC, Ricardo Mones
no flags Details | Diff

Description Martin Schwenke 2010-05-21 07:02:52 UTC
I have an entry in my address book with a display name of the form:

  Foo [Comment]

When I try to send email to this person the display name is inserted without quotes.  According to RFC2822 the "phrase" can't contain square brackets.  I think that claws-mail should check for allowable characters and quote the display name if necessary.

I'd agree with the assessment of "don't do that" if I hadn't previously used

  Tools -> Add sender to address book

to snarf the address. ;-)  The From: field was of the form:

  "Foo [Comment]" <foo@example.com>

That is, the phrase/comment was quoted in the original email.  I think that stripping the quotes when snarfing is correct behaviour.  Otherwise you end up with an address book full of quoted entries and you can't do completion on those entries.

I think the fix needs to go in at the point where the address is used.  I've looked in the code and tried to find the relevant code... but couldn't find it.  :-(
Comment 1 Ricardo Mones 2013-10-23 16:55:12 UTC
Created attachment 1306 [details]
Fix proposal

Finally I had some time to look at this and seems the attached patch fixes it.

Fixing is not at the Address Book¹ insert-time but when queuing the message. That way we're protected against potential user modification which can happen between compose-time (when the address is extracted from AB) and send-time.

Feel free to test and suggest improvements or point out mistakes ;-)


¹ Anyway AB doesn't care whether address is SMTP-correct or not.
Comment 2 users 2013-10-25 14:21:06 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=bcab9673d248f075f8917f6f614eb6d2df2e8ce8
Merge: 0d57042 d07722d
Author: Colin Leroy <colin@colino.net>
Date:   Fri Oct 25 14:21:03 2013 +0200

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=d07722d7d00132463f5a86266c22140a69aa477a
Author: Ricardo Mones <ricardo@mones.org>
Date:   Fri Oct 25 14:09:00 2013 +0200

    Fix bug #2210, but not on Address Book
    
    Bug report is titled 'Display name with invalid addresses not quoted
    when inserted from address book', but the real problem is not the AB.
    
    AB doesn't care about the address format or validity, the problem is
    sending those addresses to the SMTP server, which, as seen in the wild¹,
    might care.
    
    Fix quotes all addresses which need quoting just before writting the
    message to the queue folder.
    
    ¹http://lists.claws-mail.org/pipermail/users/2013-October/007485.html
Comment 3 Martin Schwenke 2013-11-04 02:01:54 UTC
Thanks for that.  I've been meaning to grab the sources so I can build
and test but it has been a busy couple of weeks.  :-(

Given that it is now marked as fixed, I'll leave it and be sure to
test when I see the fix packages for my distro...

Thanks again!
Comment 4 Ricardo Mones 2013-11-05 01:17:13 UTC
*** Bug 2010 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.