Let's sat I have a bunch of messages stored as .eml files in my hard
drive, and I want to use Mail to read them into a larger program for
processing. Some of those messages happen to lack a Date header, which
is invalid according to RFC2822 but can happen in the wild
nonetheless. In this specific case, I want to preserve these messages
as they originally were, warts and all.
When I read one of these malformed messages in, it starts out with a
nil Date header - #date returns nil. So far, so good. However, when I
call #to_s or #encoded on the message object, to write it back out,
Mail fills that header in with the current date. Is this the intended
behavior? Is there a way to prevent this from happening other than
taking care not to call those methods?