Advertisement
Ostap34PHP

Untitled

Aug 6th, 2018
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2.  
  3. $phone = $_POST['phone'];
  4. $name = $_POST['name'];
  5.  
  6.  
  7.  
  8. require_once('phpmailer/PHPMailerAutoload.php');
  9. $mail = new PHPMailer;
  10. $mail->CharSet = 'utf-8';
  11. //$mail->SMTPDebug = 3;                               // Enable verbose debug output
  12.  
  13. $mail->isSMTP();                                      // Set mailer to use SMTP
  14. $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  15. $mail->SMTPAuth = true;                               // Enable SMTP authentication
  16. $mail->Username = 'blablalvalvedbveD@gmail.com';                 // Наш логин
  17. $mail->Password = 'blablalvalvedbveD';                           // Наш пароль от ящика
  18. $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
  19. $mail->Port = 465;                      
  20. $mail->isHTML(true);                                  // Set email format to HTML
  21.  
  22. $mail->Subject = 'Новый заказ!';
  23. $mail->Body    = '
  24.        Пользователь оставил свои данные <br><br>
  25.        Имя:'.$name.' <br>
  26.        Телефон:'.$phone.'<br>';
  27.  
  28. //$mail->AltBody = 'Это альтернативный текст';
  29.  
  30. if(!$mail->send()) {
  31.         header('Location: index.php');
  32.     return false;
  33. } else {
  34.         header('Location: index.php');
  35.     return true;
  36. }
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement