fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]A little ) problem

2001-09-24 18:32:26
Dear Todd,

        Thanks for the clue about the problem described below (I've left
the description in this e-mail so that others can see).  I changed from
AUTO (i.e.IMAP) to POP3 and it's now OK.

Cheers,

Rob Hurle

Sorry to bother you, I am not on the list, so I would appreciate copies of
replies sent to me directly.

    I am running FreeBSD as a gateway to an ISP.  The FreeBSD system
picks up mail and holds it for the other systems on the local LAN, and I
use fetchmail to pick up mail (2 addresses).  There is a peculiarity in
that mail which has a mime boundary comes over with an extraneous
")" character appended to the last boundary.  I can set up some perl
script to fix this, but why does it happen?  My fetchmailrc file is very
standard:
[...]
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.


I don't have a solution, but I can probably tell you why it happens.
(I see the same thing, and am assuming it's the same problem.)

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(?).  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.


Todd


        -----------------------------------------------------
        Rob Hurle                        Tel: +61 2 6247 2397
        PO Box 13                        Fax: +61 2 6247 2397
        Ainslie                      Cell phone: 0417 293 603
        Australia               e-mail: 
rob(_at_)coombs(_dot_)anu(_dot_)edu(_dot_)au
        -----------------------------------------------------



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