Any bounced email returns to [email protected] for all the hosted sites. How can I change it so it returns back to the originator? In VBulletin I can do this by using SMTP for sending emails. The problem seems to be with those sites using the php mail function. Using SMTP: Code: Return-Path: <[email protected]> Using php mail: Code: Return-Path: <[email protected]>
The PHP scripts must set the correct from and return-path parameters in the php mail function as additional headers: http://www.php.net/manual/en/function.mail.php
If I do it from VBulletin I need to send the -f parameter to sendmail. On the VBulletin diagnostic page it says I can't see no errors in /var/log/mail* Any ideas?
If I use the following code without the -f option: Code: <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('[email protected]', 'My Subject', $message); ?> The email is sent and the mail log outputs the following: Code: Jul 2 02:01:55 europa postfix/pickup[28530]: E7383B583C9: uid=30 from=<wwwrun> Jul 2 02:01:55 europa postfix/cleanup[29251]: E7383B583C9: message-id=<[email protected]> Jul 2 02:01:56 europa postfix/qmgr[25689]: E7383B583C9: from=<[email protected]>, size=345, nrcpt=1 (queue active) Jul 2 02:01:57 europa postfix/smtp[29254]: E7383B583C9: to=<user@gmailcom>, relay=gmail-smtp-in.l.google.com[209.85.129.27]:25, delay=2, delays=0.14/0/1.4/0.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1183334517 g28si14191589fkg) Jul 2 02:01:57 europa postfix/qmgr[25689]: E7383B583C9: removed However, if I now attempt sending an email with the -f option: Code: <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); $returnval = mail('[email protected]', 'the subject', 'the message', null, '-f [email protected]'); ?> No email is sent and nothing gets written to any of the mail logs (messages,mail, mail.err, mail.info, mail.warn). The variable $returnval is empty.
Please use this example and not the sendmail parameters: Code: <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?>
That sent the email fine, but the return path is still [email protected]. It should be the sender. Even if I stick in Return-Path: [email protected] it still gets overwritten with the wwwrun one.