Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
php:mail [2006/05/23 01:20]
a
php:mail [2009/05/25 00:34] (current)
Line 1: Line 1:
 +====== PHP mail function on *nix plaform ======
 +
 +==== Advance stuff ====
 +
 +  * [[http://www.marki-online.net/php-secure-sendmail/]]
 +==== 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]]
 +
 +
  
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready