After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768468 - RFC822 Sender header cleanup
RFC822 Sender header cleanup
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: engine
master
Other Linux
: Normal normal
: 0.12.0
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks: 714078
 
 
Reported: 2016-07-06 02:44 UTC by Michael Gratton
Modified: 2016-07-25 00:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Gratton 2016-07-06 02:44:43 UTC
The distinction between the From and Sender headers in Geary has historically been a bit murky, especially when you throw in the requirements of and differences between RFC822, IMAP, SMTP, and the GMime lib into the mix. This bug covers cleaning it all up, to help out with bugs like 768419 and 714078.

According to RFC 2822, the From header allows a list of addresses as a value, while Sender is allowed only one address. The former describes who the message is from, while the latter is who actually sent it. Geary fills out the Sender using the first From address, however since only one Sent can currently be specified these headers often have the same value and RFC 8288 states that the Sender should only be included if different to the From header. This hasn't been a problem however since Geary hasn't actually been setting the Sender header on the GMime messages it generates — GMimeMessage only has explicit support for setting the From header (confusingly called the sender).

Further, there is a mismatch between what RFC(2)822 and IMAP ENVELOPE responses expect from the Sender and Reply-To addresses. The former expects at most one Sender, and it to not be present if the same as the From header, while the latter assumes Sender is a list, and if that or Reply-To is absent, will simply copy the value of the From header. While Geary does use ENVELOPE, it 

Geary uses the RFC822 requirements in the UI and in the Geary.RFC822.Message representation itself, while it uses the IMAP requirements for the database (although not really) and for the Geary.Email representation. This mis-match leads to a bunch of assumptions being made in a lot of places shouldn't really need to exist, or even make sense.
Comment 1 Michael Gratton 2016-07-06 03:04:37 UTC
Typos galore! "only one Sent can" should be "only one From can".

"While Geary does use ENVELOPE, it..."  also parses full message headers, so normalise at this one point of non-RFC822 compliance.
Comment 2 Michael Gratton 2016-07-25 00:47:26 UTC
Fix by bbf5f07 on master.