fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]A little ) problem

2001-09-26 07:44:08
Todd Sabin <tas(_at_)webspan(_dot_)net>:
Rob Hurle <rob(_at_)coombs(_dot_)anu(_dot_)edu(_dot_)au> writes: 
I've checked this out by using `mail.local` without fetchmail, and the ")"
is not appended in that case.  Other mail collection agents get the mail
from the ISP without the ")" - it's only fetchmail that shows this
peculiar behaviour.  Any ideas welcome.  Thanks for any help.

The problem is with the IMAP support in fetchmail.  It doesn't 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 see
this.

The case I'm familiar with 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, it throws out the whole "\r\n.\r\n", and leaves the email
body without any line terminator at the end of it.  BTW, I looked
through RFC821 at one point and couldn't find anything that says this
is incorrect, though it seems like it is to me.

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:

....blahblah)...

Where the ')' is from IMAP.

4.  Fetchmail only deals with complete lines, and doesn't trust the
stated message size, apparently because some IMAP servers state it
incorrectly(?).

Bingo.  The villain of the piece is, as you might guess, the festering
pile of rancid offal called Microsoft Exchange.  See FAQ item S2. Exchange
doesn't report message sizes correctly.

              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.

I had a look into fixing this a while ago, but it didn't seem
straightforward, and would have meant trusting the stated message
size, which might cause other problems.  Maybe Eric will find a good
solution.

I don't think there is one, short of dropping a nuclear weapon on the
Microsoft campus in Redmond.

I've added an edited version of this post to the FAQ as item X8.  Thanks
for your clear explanation of the problem -- I was too close to it to do
as well.
-- 
                <a href="http://www.tuxedo.org/~esr/";>Eric S. Raymond</a>

This would be the best of all possible worlds, if there were
no religion in it.
        -- John Adams, in a letter to Thomas Jefferson.


<Prev in Thread] Current Thread [Next in Thread>