PHP mail function on *nix plaform
Advance stuff
return-path rewrite
$mailFrom = "ValidMailbox@validdomain"; $mailTo = "ValidToAddress"; $mailSubject = "Useful Subject: Here's my subject"; $mailSignature = "\n\n--\n"; $mailSignature .= "Your friendly Neighborhood web application.\n"; $mailSignature .= "For help and other information, see http://yourwebapp/help\n"; $mailBody ="blahblahblah\n"; $mailBody .= $mailSignature; $mailHeader = 'From: "'.$mailFrom.'" '."\r\n"; $mailHeader .= "Reply-To: $mailFrom\r\n"; $mailHeader .= "X-Mailer: ".MYSITE."\r\n"; $mailHeader .= "X-Sender-IP: {$_SERVER['REMOTE_ADDR']}\r\n"; $mailHeader .= "Bcc: ".MONITORADDRESS."\r\n"; $mailParams = "-f$mailFrom"; $mailResult = mail($mailTo,$mailSubject,$mailBody,$mailHeader,$mailParams);
Be aware of this $mailParams = “-f$mailFrom”;
in php.ini
there is sendmail_path
with default settings (for *nix): sendmail -t -i
read more at http://it.extension.org/wiki/Best_Practices_Using_the_PHP_mail_Function