Home » 程式網站設計

PHPMAILER + GMAIL 終於寄出信件了 ﹨(╯▽╰)∕

One Comment | 17,306 views

phpmail1 plus022323262

PHPMAILER + GMAIL 終於寄出信件了﹨(╯▽╰)∕
在網路上找了一天 國內外的文章都看過
終於找到可以用的寫法了
GMAIL 真是龜毛
================================

require_once(“class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->CharSet = ‘utf-8’;
$mail->Encoding = ‘base64’;
$mail->From = ‘t0918013013@gmail.com’;
$mail->FromName =’ttt’;
$mail->Host =’ssl://smtp.gmail.com’;
$mail->Port = 465; //default is 25, gmail is 465 or 587
$mail->SMTPAuth = true;
$mail->Username = “*********@gmail.com";
$mail->Password = “*******";
$mail->AddAddress(“t0918013013@gmail.com");
$mail->WordWrap = 50;
if (!empty($attach))

$mail->IsHTML(false);
$mail->Subject = $subject;
$mail->Body = $body;

if(!$mail->Send())
{
echo “通知信件寄出失敗";
echo “Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo “通知信件已寄出";
?>

================================
通知信件已寄出
看到這行字還真感動

Comments

comments

標籤: