888亚洲欧美国产VA在线播放 ,亚洲av综合色区,开心五月综合亚洲,亚洲日韩天堂网中文字幕

重慶分公司,新征程啟航

為企業(yè)提供網站建設、域名注冊、服務器等服務

phpmailer怎么發(fā)送gmail郵件-創(chuàng)新互聯(lián)

這篇文章主要介紹“phpmailer怎么發(fā)送gmail郵件”,在日常操作中,相信很多人在phpmailer怎么發(fā)送gmail郵件問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”phpmailer怎么發(fā)送gmail郵件”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

創(chuàng)新互聯(lián)是專業(yè)的墨脫網站建設公司,墨脫接單;提供網站設計、網站建設,網頁設計,網站設計,建網站,PHP網站建設等專業(yè)做網站服務;采用PHP框架,可快速的進行墨脫網站開發(fā)網頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網站,專業(yè)的做網站團隊,希望更多企業(yè)前來合作!

復制代碼 代碼如下:




PHPMailer - SMTP (Gmail) basic test


//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail             = new PHPMailer();
$body             = file_get_contents('contents.html');
$body             = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.gmail.com"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "***@gmail.com";  // GMAIL username
$mail->Password   = "***";            // GMAIL password
$mail->SetFrom('****@gmail.com', 'First Last');
$mail->AddReplyTo("***@gmail.com","First Last");
$mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "***@gmail.com";
$mail->AddAddress($address, "John Doe");
$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
?>


到此,關于“phpmailer怎么發(fā)送gmail郵件”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注創(chuàng)新互聯(lián)網站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
分享題目:phpmailer怎么發(fā)送gmail郵件-創(chuàng)新互聯(lián)
路徑分享:http://www.rongbeizhuangshi.cn/article/hpodh.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP