以前都是利用mail函数或php教程ermail进行邮件发送,今天看这款利用qmail进行邮件发送,写法非常简单,是一款不错的工具.
- function send_check_mail($email, $subject,$uid,$buffer)
- {
- echo "hello";
- $command = "/var/qmail/bin/qmail-inject ".$email;
- $handle = popen($command, "w");
- if (!$handle) {
- return false;
- }
- $from = "yangxuemei2012@phpfensi.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.0n");
- fwrite($handle, "content-type: text/html; charset="gb2312"nn");
- fwrite($handle, $buffer."n");
- pclose($handle);
- return true;
- }
- $subject = "测试邮件";
- $uid = $_post['uid'];
- $content= "<html><body>".$u_email
- ." 您好!<br><br>谢谢,www.phpfensi.com!<br</body></html>";
- $u_email = "machunjie2003@phpfensi.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;
- }
|