实例
require_once ('PHPMailer/class.phpmailer.php'); //引入phpmailer文件
require_once ('PHPMailer/class.smtp.php');
$mail=new PHPMailer(); //实例化phpmailer类
$mail->IsSMTP();
$mail->CharSet='UTF-8';
$mail->AddAddress(123@163.com); //收件人邮箱
$mail->Body=$content; //发件内容
$mail->From=from@163.com; //发件人邮箱from@163.com
$mail->FromName="zjsupport"; //发件人的名字
$mail->Subject="title"; //邮件标题
$mail->Host="smtp.163.com"; //smtp服务器
$mail->SMTPAuth=true; //开启smtp服务
$mail->IsHTML(true);
//发送附件
$mail->AddAttachment(path,name); //path是附件的保存路径 name是附件的名字
//可以上传多个附件,一模一样复制 $mail->AddAttachment(path,name); 代码就行
$mail->Username="from@163.com ";//发件人邮箱
$mail->Password="123456";//发件人邮箱密码
if($mail->Send()){ //判断邮件是否发送成功
echo "success";
}else{
$email_error=$email_error.";".$val; //若不成功将发送失败的邮箱存入字符窜
}
if($email_error==""){
echo "email_success";
}else{
echo $email_error;
}
http://www.bkjia.com/PHPjc/477115.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477115.htmlTechArticle实例 require_once (PHPMailer/class.phpmailer.php); //引入phpmailer文件 require_once (PHPMailer/class.smtp.php); $mail=new PHPMailer(); //实例化phpmailer类 $mail-IsSMTP();...