Blame it on that rancid pile of dung and offal called Microsoft Exchange. Due to the problem described in S2
, the IMAP support in fetchmail cannot follow the IMAP protocol 100%. Most of the time it doesn't matter, but if you combine it with an SMTP server that behaves unusually, you'll get a spurious ) at message end.
One piece of software that can trigger this is the Interchange mail server, as used by, e.g., mailandnews.com. Here's what happens:
1. Someone sends mail to your account. The last line of the message contains text. So at the SMTP level, the message ends with, e.g. "blahblah\r\n.\r\n"
2. The SMTP handler sees the final "\r\n.\r\n" and recognizes the end of the message. However, instead of doing the normal thing, which is tossing out the ".\r\n" and leaving the first '\r\n' as part of the email body, Interchange throws out the whole "\r\n.\r\n", and leaves the email body without any line terminator at the end of it. RFC821 does not forbid this, though it probably should.
3. Fetchmail, or some other IMAP client, asks for the message. IMAP returns it, but it's enclosed inside parentheses, according to the protocol. The message size in bytes is also present. Because the message doesn't end with a line terminator, the IMAP client sees:
where the ')' is from IMAP.
4. Fetchmail only deals with complete lines, and can't trust the stated message size because Microsoft Exchange fscks it up.
5. As a result, fetchmail takes the final 'blahblah)' and puts it at the end of the message it forwards on. If you have verbosity on, you'll get a message about actual != expected.
There is no fix for this. The nuke mentioned in S2
looks more tempting all the time.