The return path header is added by the SMTP host. When the computer says: "MAIL FROM: xxx@xxx.com" to the remote computer,
The PHP mail function lacks some flexibility when it comes to message headers and customizing who your email is from. To do this you'll need to have PHP manually open a socket manually to an SMTP server and talk to it by its self. I've attached a class that I use which does this.
To use it you'll need to know the name of your web hosts SMTP server or an SMTP server you can log on to, to send your messages. If you don't set an SMTP host the class will go ahead and use PHP's mail function.
The class can also send attachments with the message and send them in HTML format. All the encoding is wrapped in the class, all you have to worry about is the message its self. Here's an example of how the class can be used:
<?php
$fhwnd = fopen('test.php', 'r');
$file = fread ($fhwnd, filesize('test.php'));
fclose ($fhwnd);
require ('mail.inc');
$mail = new mail_message;
$mail->from ('Me', 'me@myhost.com'); // this sets the actual from address header
$mail->add_attachment ($file, 'test.txt', 'text/plain'); // add the fille retrieved earlier as an attachment
$mail->add_recipient ('Mr No One', 'no_one@yahoo.com'); // add a recipient
$mail->subject = 'The Subject'; // set the subject line
$mail->smtp_from = 'weird@myreturn.com'; // this will set the return path
$mail->smtp_host = 'post.smtp.com'; // set the host
$mail->body =
'This is the message body:
Line1
Line2
Line3';
$mail->send(); // send the message
?>
Its worth doing a little reading on SMTP and mail headers as the class is not forgiving when a message is constructed in the wrong fashion.