|
 |
|
สอบถาม PHPMailer หน่อยครับ จะแก้ไขชื่อคนส่ง ยังไงครับ ตามภาพที่แนบมา |
|
 |
|
|
 |
 |
|
Code (PHP)
function sendemail() {
$user=$_POST['user'];
$email=$_POST['email'];
$pass=$_POST['tel'];
require("../send/class.phpmailer.php");
// $fm = "[email protected]"; // *** ต้องใช้อีเมล์ @gmail.com เท่านั้น ***
$to = $email; // อีเมล์ที่ใช้รับข้อมูลจากแบบฟอร์ม
// $namefrom = "xxxxxxx";
// $custemail = "xxxxxxxx@xxxxxxxxx"; // อีเมล์ของผู้ติดต่อที่กรอกผ่านแบบฟอร์ม
$subj = "xxxxxxxxxxxxxxxxx;
/* ------------------------------------------------------------------------------------------------------------- */
$message="";
/* ------------------------------------------------------------------------------------------------------------- */
/* หากต้องการรับข้อมูลจาก Form แบบไม่ระบุชื่อตัวแปร สามารถรับข้อมูลได้ไม่จำกัด ให้ลบบรรทัด 11-14 แล้วใช้ 19-22 แทน
foreach ($_POST as $key => $value) {
//echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
$message.= "Field ".htmlspecialchars($key)." = ".htmlspecialchars($value)."\n";
}
*/
$mesg = $message;
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
/* ------------------------------------------------------------------------------------------------------------- */
/* ตั้งค่าการส่งอีเมล์ โดยใช้ SMTP ของ Gmail */
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->IsSMTP(); // telling the class to use SMTP
$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 = "xxxxxxxxxxxx"; // Gmail Email username
$mail->Password = "xxxxxxxxxxxxxxx"; // Gmail Email password
/* ------------------------------------------------------------------------------------------------------------- */
// $mail->Namefrom = $namefrom;
// $mail->Form = $fm;
$mail->AddAddress($to);
// $mail->AddReplyTo($custemail);
$mail->Subject = $subj;
$mail->Body = $mesg;
$mail->WordWrap = 1000;
$mail->send();
//
// if(!$mail->Send()) {
// echo 'Message was not sent.';
// echo 'ยังไม่สามารถส่งเมลล์ได้ในขณะนี้ ' . $mail->ErrorInfo;
// exit;
// } else {
// echo 'ส่งเมลล์สำเร็จ';
// }
}
|
 |
 |
 |
 |
Date :
2018-07-25 16:36:31 |
By :
2037881702931155 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|