用phpmailer发送HTML邮件

用phpmailer发送HTML邮件

<?php
include_once("class.phpmailer.php");;
$formmail="[email protected]";
$subject = "实验";   
$smtp="smtp.126.com";
$username="[email protected]";
$password="**********";


$mail=new PHPMailer();
$mail->SMTPAuth = true;
$mail->Host=$smtp;
$mail->IsSMTP();
$mail->SMTPAuth=true;
$mail->Username=$username;
$mail->Password=$password;
$mail->From="[email protected]";
$mail->FromName="Souba激活";
$mail->Sender="[email protected]";
$mail->Subject =$subject;
$mail->IsHTML(true);
$mail->Body ="<a href='www.google.com' target='_blank'>google</a>";

$mail->AddAddress($formmail);
if(!$mail->Send())
{
echo "发送失败";
}
else
{
echo "发送成功";
}
?>

你可能感兴趣的:(html)