教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 PHP下MAIL的另一解决方案

PHP下MAIL的另一解决方案

发布时间:2017-10-22   编辑:jiaochengji.com
教程集为您提供PHP下MAIL的另一解决方案等资源,欢迎您收藏本站,我们将为您提供最新的PHP下MAIL的另一解决方案资源
前一段时间我接触到DEC Tru64 Unix 我在上面装了PHP APACHE,可以用提供的mail函数始终不能正常发信,于是自编了一个函数,它利用UNIX下的管道和PHP的SOCK函数进行发信,经过实验非常驻成功,下面是此函数原代码。
function mymail($mto,$mcc,$msubject,$mbody)
{
$from="webmaster@backhome.com.cn";
$sign = " ";//随你便写些什么
$sendmailpath="/usr/lib/sendmail";//Semdmail路径
$bound = "========_".uniqid("BCFMail")."==_";//分界符
$headers = "MIME-Version: 1.0 ".
"Content-Type: multipart/mixed; boundary="$bound" ".
"Date: ".date("D, d M H:i:s Y ")." ".
"From: $from ".
"To: $mto ".
"Cc: $mcc ".
"Subject: $msubject ".
"Status: ".
"X-Status: ".
"X-Mailer: MY Email Interface ".
"X-Keywords: ";
$content="--".$bound." "."Content-Type:text/plain;charset="GB2312" ".$mbody.$sign." ";
$end = " "."--".$bound."-- ";
$sock = popen("$sendmailpath -t -f 'webmaster@backhome.com.cn'",'w');
fputs($sock, $headers);
fputs($sock, $content);
fputs($sock, $end);
fputs($sock, ". ");
fputs($sock, "QUIT ");
pclose($sock);
}



您可能感兴趣的文章:
PHPmailer邮件群发的入门例子
phpmailer发送邮件及实现密码找回功能的代码
phpmailer发邮件中文乱码问题如何解决
PHPMailer发送邮件代码实例(ubuntu系统)
phpmailer中文乱码问题解决方法
phpmailer 发送邮件中文乱码问题的解决方法总结
phpmailer发送yahoo邮件的例子
利用Typecho解决Gravatar被墙的问题
PHPmailer发送邮件及乱码问题的解决
PHPMailer邮件标题中文乱码的解决方法

[关闭]
~ ~