以前都是利用mail函数或php教程ermail进行邮件发送,今天看这款利用qmail进行邮件发送,写法非常简单,是一款不错的工具.
- 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@Vevb.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']; //from信息
- $content= "<html><body>".$u_email
- ." 您好!<br><br>谢谢,www.Vevb.com!<br</body></html>"; //内容信息
- $u_email = "machunjie2003@Vevb.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;
- }
新闻热点
疑难解答