note 53704 added to ref.mail
| From: | ECRIA at osu1 dot php dot net | Date: | Thu, 09 Jun 2005 17:23:37 +0000 |
| Subject: | note 53704 added to ref.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90191@lists.php.net to get a copy of this message | ||
The most common problem people have with the mail() function is the failure to include an additional
header containing the from address in the call (along with the standard from address). This commonly
results in failed delivery due to spam filtering at the receiving end. The solution: set your
header-from address, or use this function:
<?
function MAIL_NVLP($fromname, $fromaddress, $toname, $toaddress, $subject, $message)
{
// Copyright © 2005 ECRIA LLC, http://www.ECRIA.com
// Please use or modify for any purpose but leave this notice unchanged.
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$fromname."\"
<".$fromaddress.">\n";
return mail($toaddress, $subject, $message, $headers);
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53704
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53704&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53704&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53704&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53704&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53704&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53704&report=yes
Search -- http://master.php.net/manage/user-notes.php