Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello: I am trying to write an email applciation using MIMI::Lite for a client of ours. If the email is undeliverable I want it to bounce to an address other than the from address. However, I cannot figure out how to do this with MIMI::Lite. The following is a code snippet:

$msg = MIME::Lite->new(
"Return-Path" =>'cm@route.com',
From =>test@yahoo.com',
To =>'testtestttEmailFunkkodo@test.com',
Subject =>'A message with 2 parts...',
Type =>'text/plain',
CC =>'tom.conti@monster.com',
Data =>$testBody );

The email address is bogus and consistently bounces to the from address. I have tried to use the Return-Path attribute but iot seems to get stripped out of the headers by one of the server that handles this mail. Is there another attribute that will redirect the bounce address or is there another package that would help me with this problem.

Thanks, Tom

Replies are listed 'Best First'.
Re: Bounced address in MIME::Lite
by Limbic~Region (Chancellor) on Aug 03, 2002 at 00:15 UTC
    I am pretty sure that MIME::Lite does not allow you to distinguish between the envelope "mail from:" and the header "FROM: ", and there in lies your problem. According to the RFC, the DSN (delivery status notification) must go to the original sender (the envelope from and not the internal message header from). It is possible (perhaps not with MIME:Lite), to send a message with a different outside from than the inside from. I can't recommend a better package for you without knowing your and/or your client's needs.

    Cheers L~R

Re: Bounced address in MIME::Lite
by tjh (Curate) on Aug 02, 2002 at 23:22 UTC
    I believe mail servers are supposed to bounce to the From address. But just as an experiment, try the Reply-To header and see if that works. Email headers are not universally supported correctly or in similar ways by all mail servers.
Re: Bounced address in MIME::Lite
by hacker (Priest) on Aug 03, 2002 at 12:41 UTC
    It might have something to do with the missing quote as shown here:
    From =>test@yahoo.com', # ^ missing quote
    Also, you needn't double-quote Return-Path as you have in your example also:
    "Return-Path" =>'cm@route.com',
      Thanks, I'll give these a try.