apache / incubator-ponymail-foal

Apache Pony Mail Foal (Next Generation Suite)
https://ponymail.apache.org
Apache License 2.0
22 stars 14 forks source link

To: and Cc: should be stored as arrays #132

Open sebbASF opened 2 years ago

sebbASF commented 2 years ago

To and Cc headers are currently stored as a raw string with embedded new-line characters. Would it not be better to store them as arrays of individual addresses?

Humbedooh commented 2 years ago

I think that would be a good upgrade. While we're at it, the References and In-Reply-To fields could probably be turned into arrays as well, for easier searching. Currently there is a hack with phrase matching to find threads, if this was an array, things would be a lot easier.

sebbASF commented 2 years ago

We could store the emails as a list of pairs: real name, email address.

We should use email.utils.getaddresses() for parsing. AFAICT it even handles commas in real name entries.

I don't know if we need to keep the raw values at all?

Note that From can also be a list, in which case Sender must be present: https://datatracker.ietf.org/doc/html/rfc2822#section-3.6.2 I think we need to allow for that as well.