php 發送郵件

$sql = "INSERT INTO ".$wpdb->prefix . "applicant(name,phone,url) VALUES ('".$name."','".$phone."','".$url."')";
$results = $wpdb->query($sql);
//發送郵件提醒有人申請
$smtpserver = "smtp.qq.com"; //SMTP服務器,如:smtp.qq.com
$smtpserverport = 25; //SMTP服務器端口,一般爲25
$smtpusermail = "[email protected]"; //SMTP服務器的用戶郵箱,如[email protected]
$smtpuser = "[email protected]"; //SMTP服務器的用戶帳號[email protected]
$smtppass = "........."; //SMTP服務器的用戶密碼
$smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass); //實例化郵件類
$emailtype = "HTML"; //信件類型,文本:text;網頁:HTML
$smtpemailto = "[email protected]"; //接收郵件方,本例爲註冊用戶的Email
$smtpemailto1 = "[email protected]"; //接收郵件方,本例爲註冊用戶的Email
$smtpemailfrom = $smtpusermail; //發送郵件方,如[email protected]
$emailsubject = "用戶申請試用";//郵件標題
//郵件主體內容
date_default_timezone_set('Etc/GMT-8');     //這裏設置了時區
$emailbody = "<h1>一份產品申請試用報告書:</h1><br/>申請人:".$name."<br/>電話:".$phone."<br/>網址:".$url."<br/><br/><div style='border-top:1px dashed #ddd; text-align: right; padding-top:20px;'>XXXXX軟件科技有限公司<br/>".date("Y-m-d H:i")."</div>";
//發送郵件
$rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
$rs1 = $smtp->sendmail($smtpemailto1, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
// if($rs==1){
// $msg = '恭喜您,註冊成功!<br/>請登錄到您的郵箱及時激活您的帳號!';
// }else{
// $msg = $rs;
// }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章