You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Bosco So <bo...@despammed.com> on 2004/01/17 10:55:29 UTC

fast fails going to Reply-To: instead of Return-Path:

As I noted in a previous message, I'm finding that James is responding 
to some fast fails with a bounce message to the email address specified 
in the Reply-To: header rather than the Return-Path. Is this behavior 
correct? (In my app, the Reply-To:, Return-Path:, and From: are all 
different.)

I can reproduce this by sending a message to 
"test123@profitfrompeace.org". (Yes, that domain is mine.) A 
hand-telnet'ed SMTP session looks like this:

    220 m1.dnsix.com ESMTP Exim 4.24 Sat, 17 Jan 2004 01:24:44 -0800
    helo thames.dnsalias.org
    250 m1.dnsix.com Hello thames.dnsalias.org [67.112.120.26]
    mail from: <bo...@despammed.com>
    250 OK
    rcpt to: <te...@profitfrompeace.org>
    550 unrouteable address
    quit

Here's what the various James logs say when I spool my VERPed message 
through James:

    ==>
    james/james-2.2.0a15/apps/EmailNow2/logs/mailet-2004-01-17-00-59.log <==
    17/01/04 01:41:24 INFO  James.Mailet: RemoteDelivery: Attempting
    delivery of Mail1074332484416-10-to-profitfrompeace.org to host
    m1.dnsix.com. to addresses [test123@profitfrompeace.org]
    17/01/04 01:41:25 INFO  James.Mailet: RemoteDelivery: Permanent
    exception delivering mail
    (Mail1074332484416-10-to-profitfrompeace.org:
    javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
            class javax.mail.SendFailedException: 550 unrouteable address

            at
    com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:926)
            at
    com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:389)
            at
    org.apache.james.transport.mailets.RemoteDelivery.deliver(RemoteDelivery.java:346)
            at
    org.apache.james.transport.mailets.RemoteDelivery.run(RemoteDelivery.java:797)
            at java.lang.Thread.run(Thread.java:534)

    17/01/04 01:41:25 INFO  James.Mailet: RemoteDelivery: Sending
    failure message Mail1074332484416-10-to-profitfrompeace.org
    17/01/04 01:41:25 INFO  James.Mailet: ReplyHandlerMailet: Handling
    reply:
    reply.5.10047.3701388142751010471-test123_profitfrompeace.org@thames.dnsalias.org
    17/01/04 01:41:25 INFO  James.Mailet: ReplyHandlerMailet: this reply
    is actually a bounce
    17/01/04 01:41:25 INFO  James.Mailet: ReplyHandlerMailet: state:
    transport
    17/01/04 01:41:25 INFO  James.Mailet: ReplyHandlerMailet: changed
    recip to:
    owner.5.10047.3701388142751010471-test123_profitfrompeace.org@thames.dnsalias.org
    17/01/04 01:41:25 INFO  James.Mailet: BounceHandlerMailet: bouncing
    all:       
    owner.5.10047.3701388142751010471-test123_profitfrompeace.org@thames.dnsalias.org

    ==>
    james/james-2.2.0a15/apps/EmailNow2/logs/james-2004-01-17-00-59.log <==
    17/01/04 01:41:25 WARN  James: Mail to be bounced does not contain a
    Return-Path header.

I wrote both ReplyHandlerMailet and BounceHandlerMailet. When I first 
wrote the former, I noticed that some badly addressed emails were marked 
in the database as replies. After I figured out that these fast fails 
were getting sent to the Reply-To: address, I added a tweak in the 
ReplyHandlerMailet to check the From: field of the bounced message for 
the James postmaster. If found, then I change To: header of the message 
from reply.blahblahblah to owner.blahblahblah and skip normal reply 
handling. Next in the chain is the BounceHandler mailet which notices 
the owner.blahblahblah To: header and records a bounce record in the 
database.

Lastly, I don't know why I'm always getting the "Mail to be bounced does 
not contain a Return-Path header".

-- Bosco

Re: fast fails going to Reply-To: instead of Return-Path:

Posted by Bosco So <bo...@despammed.com>.
Noel wrote:

>>I'm finding that James is responding to some fast fails with
>>a bounce message to the email address specified in the
>>Reply-To: header rather than the Return-Path.
>>    
>>
>[...]
>I don't know why you don't have a Return-Path: header off-hand, but that is
>the cause of your problem.  I'm not entirely sure that we need to be using
>the header.  I would have to review the RFC, again, but I believe that
>Mail.getSender() would provide a suitable value. 
>[...]
>
I found a clue toward figuring why James-generated bounces are going to 
the Reply-To header. When I look at the spool files corresponding to 
messages that are being retried, I find no Return-Path headers in them. 
So I suspect that when these messages eventually fail all the configured 
retries, James sends a bounce message, finds no Return-Path, and uses 
Reply-To instead. This doesn't explain why fast fails are also bouncing 
to the Reply-To, but I'll generate a whole bunch of fast fails and see 
what happens.

I'll also generate a large bunch of fast successes so I can eyeball some 
of the spooled files before they get sent.

-- Bosco

RE: fast fails going to Reply-To: instead of Return-Path:

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I'm finding that James is responding to some fast fails with
> a bounce message to the email address specified in the
> Reply-To: header rather than the Return-Path.

See James.bounce(Mail, String, MailAddress).  MimeMessage.reply(boolean)
prepares the new message using the Reply-To: header.  If there is no
Return-Path header:, then the Reply-To: header value is being used.

I don't know why you don't have a Return-Path: header off-hand, but that is
the cause of your problem.  I'm not entirely sure that we need to be using
the header.  I would have to review the RFC, again, but I believe that
Mail.getSender() would provide a suitable value.

By any chance are these messages that you are building internally?  FWIW, I
am attaching a mailet that I've used for debugging.

	--- Noel