note 40177 added to function.mail
| From: | arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi | Date: | Tue, 24 Feb 2004 13:11:41 +0000 |
| Subject: | note 40177 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65646@lists.php.net to get a copy of this message | ||
I had problems with Hotmail spam blocking. Account activations etc. were moved to Junkbox. Got it
working with this function. Hope this save someones time:
<?php
function mymail($to, $title, $body, $from = '') {
$from = trim($from);
if (!$from) {
$from = 'My Name <myaccount@mydomain.com>';
}
$rp = 'ReturnNonWorkingHere@MySite.net';
$org = 'MySite.net';
$mailer = 'MKSR-Postimies';
$head = '';
$head .= "Content-Type: text/plain \r\n";
$head .= "Date: ". date('r'). " \r\n";
$head .= "Return-Path: $rp \r\n";
$head .= "From: $from \r\n";
$head .= "Sender: $from \r\n";
$head .= "Reply-To: $from \r\n";
$head .= "Organization: $org \r\n";
$head .= "X-Sender: $from \r\n";
$head .= "X-Priority: 3 \r\n";
$head .= "X-Mailer: $mailer \r\n";
$body = str_replace("\r\n", "\n", $body);
$body = str_replace("\n", "\r\n", $body);
return mail($to, $title, $body, $head);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40177
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40177&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40177&report=yes
Search -- http://master.php.net/manage/user-notes.php