Created
January 8, 2020 11:25
-
-
Save Dexdot/352da9c8143f7188a22a5ff41a683326 to your computer and use it in GitHub Desktop.
smtp test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username=$_POST['form_name']; | |
$phone=$_POST['form_phone']; | |
$message = " | |
Имя: ".htmlspecialchars($username)."<br /> | |
Телефон: ".htmlspecialchars($phone); | |
require_once('phpmailer/PHPMailerAutoload.php'); | |
$mail = new PHPMailer; | |
$mail->CharSet = 'utf-8'; | |
$mail->isSMTP(); | |
$mail->Host = 'smtp.yandex.ru'; | |
$mail->SMTPAuth = true; | |
$mail->Username = 'username@yandex.ru'; | |
$mail->Password = 'password'; | |
$mail->SMTPSecure = 'ssl'; | |
$mail->Port = 465; | |
$mail->SMTPDebug = 2; | |
$mail->setFrom('username@yandex.ru', 'SHUBOX - заявка с сайта'); | |
$mail->addAddress('dolotter@gmail.com'); | |
$mail->isHTML(true); | |
$mail->Subject = 'SHUBOX - заявка с сайта'; | |
$mail->Body = $message; | |
if(!$mail->send()) { | |
echo 'Message could not be sent.'; | |
echo 'Mailer Error: ' . $mail->ErrorInfo; | |
} else { | |
echo 'Message has been sent'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment