A server I manage hosts around 200 sites each owned by different webmasters. A number of these have form to mail style scripts. A small problem is that the mailserver appears to be receiving emails from these scripts as anonymous@hostname.co.uk. When an invalid email address is given on the form these bounces are going back to postmaster@hostname.co.uk.
I was asked to fix the scripts to ensure that the bounces go back to the $from field. Here is a quick fix.
Append -f $to to the mail() line… For example change
This
mail($to, $subject, $message, $headers);
To this
mail($to, $subject, $message, $headers, '-f $bounceto');
Leave a Reply