简单测试PHPMailer发送邮件

require './class.phpmailer.php';

$mail=new PHPMailer();
$mail->ContentType="text/html";
$mail->Encoding="base64";
$mail->IsSMTP();
$mail->Host="smtp.163.com";
$mail->SMTPAuth=true;
$mail->Username="
[email protected]";
$mail->Password="123456";
$mail->SetFrom("
[email protected]","test");
$content=<<<EMAIL
这是一封测试的邮件,请不要做过多的关注!
EMAIL;
$mail->Subject="邮件测试";
$mail->AddAddress("
[email protected]","newMail");
$mail->Body=$content;
if($mail->Send()){
 echo "发送成功!";
}else{
 echo "发送失败!".$mail->ErrorInfo;
}

你可能感兴趣的:(简单测试PHPMailer发送邮件)