in reply to Setting the return path in Sendmail

As others have commented, you may find the CPAN modules make this easier to implement (I know I have).

Currently, I'm using MIME::Lite, which let's you do something like this:

my $sender = 'yourname@example.com'; my $msg = MIME::Lite->new( Type => 'TEXT', From => $sender, To => 'theirname@example.com', Subject => 'Simple Greeting' ReplyTo => $sender, ErrorsTo => $sender, Data => 'Greetings, Lifeform!' ); $msg->send_by_smtp( 'localhost' ) or die "Unable to send message; reason $!\n";

Note: the above is off the top of my head, so there may be typos or other silly mistakes. If so, sorry.

The interesting bit, I think, in the above is the ErrorsTo line. That seems to work, provided you take care to send it to an appropriate address. For example, I have a special mailbox devoted to those errors.

MIME::Lite also offers several alternatives for sending. For details, check the docs.

Hope this helps...

--f