CharSet = "utf-8"; $mail->IsSMTP(); $mail->Mailer = "smtp"; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "tls"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server // $mail->Host = "142.251.175.108"; // sets GMAIL as the SMTP server $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "mailsystem@wasan.me"; // Gmail username หรือหากท่านใช้ G-suite / WorkSpace ให้ใช้อีเมล์ @you@yourdomain แทน $mail->Password = "ilxcfzmbpxldgcgh "; $mail->SetFrom("mailsystem@wasan.me", "no-reply"); //$mail->AddReplyTo($replyto, $replyto_name);//ชื่อ Mail ให้ลูกค้าตอบกลับ $mail->Subject = $subject; //ชื่อหัวเรื่อง $mail->MsgHTML($body); $mail->AddAddress($reciver_address, $reciver_name); // ผู้รับคนที่หนึ่ง //$mail->AddAddress("recipient2@somedomain.com", "recipient2"); // ผู้รับคนที่สอง if (!$mail->Send()) { $re = 1; // echo "Mailer Error: " . $mail->ErrorInfo; } else { $re = 0; // echo "Message sent!"; } return $re; } echo send_mail("thanunchai.jm@gmail.com", "M", "tset", "TEST");