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 = "

一份产品申请试用报告书:


申请人:".$name."
电话:".$phone."
网址:".$url."

XXXXX软件科技有限公司
".date("Y-m-d H:i")."
";
//发送邮件
$rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
$rs1 = $smtp->sendmail($smtpemailto1, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
// if($rs==1){
// $msg = '恭喜您,注册成功!
请登录到您的邮箱及时激活您的帐号!';
// }else{
// $msg = $rs;
// }

你可能感兴趣的:(PHP,php,邮件)