mox/message
Mechiel Lukkien 19550cc041
use Go's mail.ReadMessage instead of textproto.ReadMIMEHeaders and decode RFC 2047 charsets in subject header when parsing message
as the recent Go patch release showed, textproto.ReadMIMEHeaders is parsing
http headers, strictly. too strict for email message headers. valid headers,
e.g. with a slash in them, were rejected by textproto.ReadMIMEHeaders.

the functions in Go's mail package handle RFC 2047 charset-encoded words in
address headers. it can do that because we tell it those headers are addresses,
where such encodings are valid. but that encoding isn't valid in all places in
all headers. for other cases, we must decode explicitly, such as for the
subject header.

with this change, some messages that could not be parsed before can now be
parsed (where headers were previously rejected for being invalid). and the
subject of parsed messages could now be properly decoded. you could run "mox
ensureparsed -all <account>" (while mox isn't running) to force reparsing all
messages. mox needs a subcommand to reparse while running...

it wasn't much of a problem before, because imap email clients typically do
their own parsing (of headers, including subject decoding) again.  but with the
upcoming webmail client, any wrong parsing quickly reveals itself.
2023-08-01 09:50:26 +02:00
..
doc.go mox! 2023-01-30 14:27:06 +01:00
from.go mox! 2023-01-30 14:27:06 +01:00
headerwriter.go mox! 2023-01-30 14:27:06 +01:00
part.go use Go's mail.ReadMessage instead of textproto.ReadMIMEHeaders and decode RFC 2047 charsets in subject header when parsing message 2023-08-01 09:50:26 +02:00
part_test.go add pedantic mode (used by localserve) that refuses some behaviour that is invalid according to specifications and that we normally accept for compatibility 2023-03-12 15:16:01 +01:00
readheaders.go mox! 2023-01-30 14:27:06 +01:00
time.go tweak time format for added date headers 2023-06-04 21:04:10 +02:00
todo.go mox! 2023-01-30 14:27:06 +01:00
writer.go mox! 2023-01-30 14:27:06 +01:00
writer_test.go mox! 2023-01-30 14:27:06 +01:00