前一段时间我接触到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); } (责任编辑:admin) |