用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.2cto.com' target='_blank'>google</a>";
$mail->AddAddress($formmail);
if(!$mail->Send())
{
echo "發送失敗";
}
else
{
echo "發送成功";
}
?>
摘自 潇湘博客