note 1650 modified in mail by ronabop
| From: | ronabop@php.net | Date: | Mon, 02 Oct 2000 10:00:45 +0000 |
| Subject: | note 1650 modified in mail by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5847@lists.php.net to get a copy of this message | ||
My rewrite of the mail function:
function n_mail( $from, $to , $subject,$core_msg, $add_header)
{
$cmd_line=sprintf("/usr/sbin/sendmail -r %s -t",$from);
$fp=popen($cmd_line,"w");
$temp=sprintf("To: %s\n",$to);
$len=strlen($temp);
$ret_p=fputs($fp,$temp,$len);
$temp=sprintf("Subject: %s\n",$subject);
$len=strlen($temp);
$ret_p=fputs($fp,$temp,$len);
if ($add_header != "")
{
$temp=sprintf("%s\n",$add_header);
$len=strlen($temp);
$ret_p=fputs($fp,$temp,$len);
}
$temp=sprintf("\n%s\n",$core_msg);
$len=strlen($temp);
$ret_p=fputs($fp,$temp,$len);
pclose($fp);
}
There are no tests here ... not enought place
but testing the returns is better ....
http://www.php.net/manual/function.mail.php