以前都是利用mail函数或php教程ermail进行邮件发送,今天看这款利用qmail进行邮件发送,写法非常简单,是一款不错的工具.
<?php function send_check_mail($email, $subject, $uid, $buffer) { echo "hello"; $command = "/var/qmail/bin/qmail-inject " . $email; //qmail程序地址,$email是要发送的地址 $handle = popen($command, "w"); //打开管道 if (!$handle) { return false; } $from = "yangxuemei2012@phprm.com"; //发件人 fwrite($handle, "from: " . $from . "\n"); //往管道写数据 fwrite($handle, "return-path: " . $from . "\n"); fwrite($handle, "to: " . $uid . "\n"); fwrite($handle, "subject: " . $subject . "\n"); fwrite($handle, "mime-version: 1.0\n"); fwrite($handle, "content-type: text/html; charset=\"gb2312\"n\n"); fwrite($handle, $buffer . "\n"); pclose($handle); //关闭管道 return true; } $subject = "测试邮件"; $uid = $_post['uid']; //from信息 $content= "<html><body>".$u_email ." 您好!<br><br>谢谢,www.phprm.com!<br</body></html>"; //内容信息 $u_email = "machunjie2003@phprm.com"; //发送到的邮箱 if (send_check_mail($u_email, $subject, $uid, $content)) { echo "恭喜!发送投票邮件到您的邮箱!<br><br>请检查您的邮箱:<font color=#cc0033>".$u_email." </font><br><br>". $close; } else { echo "很不幸,发送投票邮件到您的邮箱失败,请重试或者联系开发人员。<br><br>". $close; }
文章链接:
随便收藏,请保留本文地址!