Open sebbASF opened 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.
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.
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?