Last active
August 24, 2017 13:28
-
-
Save Dexdot/b20614be105e4a4a8ff765e41eb191f3 to your computer and use it in GitHub Desktop.
phpmailerRus
This file contains hidden or 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 | |
| $whatever=$_POST['whatever']; | |
| $username=$_POST['username']; | |
| $phone=$_POST['phone']; | |
| $message = " | |
| Имя формы: ".htmlspecialchars($whatever)."<br /> | |
| Имя пользователя: ".htmlspecialchars($username)."<br /> | |
| Телефон: ".htmlspecialchars($phone); | |
| require_once('prod/vendor/phpmailer/PHPMailerAutoload.php'); | |
| $mail = new PHPMailer; | |
| $mail->CharSet = 'utf-8'; | |
| $mail->isSMTP(); | |
| $mail->Host = 'smtp.gmail.com'; | |
| $mail->SMTPAuth = true; | |
| $mail->Username = 'name@gmail.com'; | |
| $mail->Password = 'password'; | |
| $mail->SMTPSecure = 'ssl'; | |
| $mail->Port = 465; | |
| $mail->setFrom('name@gmail.com', 'Заявка с сайта'); | |
| $mail->addAddress('mail@bk.ru'); | |
| //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments | |
| //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name | |
| $mail->isHTML(true); | |
| $mail->Subject = 'Заявка с сайта'; | |
| $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