[imp] bounce mail error

Stephen Fischer sfi@unsw.edu.au
Fri, 23 Feb 2001 11:05:42 +1100


I think I've found the problem, but since I didn't actually know anything
about php when I started looking into what was going on, I could easily be
missing something.

What was happening is that when IMP grabbed the headers in order to modify
them and send the mail, it also grabbed the body and this was causing
problems, as this bit of debug output shows(^@ = '\0'):

key = #X-Originating-IP#
val = #129.94.1.132
blort
^@#
key = #Resent-Date#
val = #Thu, 22 Feb 2001 18:36:44 +1100 (EST)#

The body was being attached to the last header, irregardless of what it was.

I traced the problem to the call on line 466 of compose.php3:

  $headers = imap_fetchheader($imp->stream, $index, FT_PREFETCHTEXT | FT_UID);

If I remove the FT_PREFETCHTEXT flag, which seems to mean that I now only grab
the headers, the bounced message makes it through fine, headers, body, and
all.  In other words, the new line should be:

  $headers = imap_fetchheader($imp->stream, $index, FT_UID);

Please let me know if that flag was in there for some reason that I haven't
worked out.  It looks like the message body is grabbed separately in the same
code block, which makes sense since it shows up in the delivered message.

There is a similar call in view.php3, but that looks like it should be ok
because the message is treated as one block there.

Hope this helps,
Stephen



quoth Stephen Fischer:
| I'm testing imp as a potential IMAP webmail client and it mostly works
| smoothly.  However, I have stumbled across one possibly obscure glitch when I
| try to bounce a message from one user to another on my imap server.
| 
| Let me see how well I can describe it.
| 
| Software:
| IMAP server: Solaris 8
|              Cyrus imap 1.6.24
|              sendmail 8.10.1
|              mutt 1.2.5i
| 
| (the imap server is also my local machine - gryphon.comms.unsw.edu.au)
| 
| Webclient machine: Solaris 8
|                    apache 1.3.17
|                    php 4.0.4pl1
|                    horde 1.2.4
|                    imp 2.2.4
| 
| (taxes.comms.unsw.edu.au)
| 
| It's all compiled and installed as per specs - the test page works, imp itself
| works as expected.  The IMAP server has been running for months now without
| problems.
| 
| However, I sent a message from an external account (<foreign-user>) to <user1>
| at the IMAP server.  I then tried to bounce it to <user2> on the same server
| using IMP both from my installation and from the demo software setup and
| received the following message (full message from the demo attempt attached -
| bounce.txt):
| 
| ... while talking to cyrus:
| >>> DATA
| <<< 554 5.6.0 Message contains bare newlines
| 554 5.0.0 <sfi@gryphon.comms.unsw.edu.au>... Service unavailable
| 
| 
| Checking out the cyrus code, this occurs when it contains a '\n' without a
| '\r' preceding it, which seems to be what the 822 spec requires.
| 
| I also found that bouncing to the <foreign-user> account works even when
| bouncing to <user2> doesn't, probably because the mail server software there
| copes with receiving '\n' without '\r' (their mail server definitely does this
| but I'm drawing conclusions from that fact).
| 
| Trying to narrow it down, I tried sending a message from <user1> to <user1>
| and bouncing it to <user2>.  This failed in a similar way, and I have
| captured the header and body files that sendmail uses, and attached these
| files ([dq]ff1G3tRW14351).  
| 
| I also tried the same sequence of events using the mutt mail client, and the
| bounces worked fine.  I notice that it didn't try to add anything to the body
| of the mail, unlike IMP, which is where I suspect the problem lies.
| 
| Sending mail and forwarding mail between these accounts works.  It's just
| bouncing that fails.
| 
| Finally, I tried doing the same thing with the demo with the same results, so
| it shouldn't be my installation of IMP.  I've grabbed copies of these files
| from the sendmail queue, because it couldn't deliver the error message either
| ([dqx]ff1G5GgX04983).
| 
| 
| I hope I haven't left out any important details.  I tried to check the bug
| website but it doesn't seem to be available, so hopefully I'm not reporting
| something that everyone knows about.
| 
| Stephen Fischer
| UNSW - programmer