ก้อนนี้ต้องมีถ้าจะส่งเมล์เข้า google app serv
$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->AddAddress("[email protected]", "Mr.xxxx xxxx"); // to Address
แถวนี้สามารถส่งเข้า google app serv ได้
คืองงนะครับ
<?
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";
$strMessage = nl2br($_POST["txtDescription"]);
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "Email Sending.";
}
else
{
echo "Email Can Not Send.";
}
?>
<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->IsSMTP();
$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 = "[email protected]"; // GMAIL username
$mail->Password = "My Password"; // GMAIL password
$mail->From = "Mr.xxxx xxxx"; // "[email protected]";
//$mail->AddReplyTo = "[email protected]"; // Reply
$mail->FromName = "Mr.xxxx xxxx"; // set from Name
$mail->Subject = "Test sending mail.";
$mail->Body = "My Body & My Description";