Advertisement
Guest User

Untitled

a guest
Jul 15th, 2017
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. date_default_timezone_set('Europe/Moscow');
  4. require 'phpMailer/PHPMailerAutoload.php';
  5.  
  6. $mail = new PHPMailer;
  7.  
  8. $mail->IsSMTP();
  9. $mail->Host = 'smtp.gmail.com';
  10. $mail->SMTPAuth = true;
  11. $mail->SMTPSecure = 'ssl';
  12. $mail->Port = 465;
  13. $mail->CharSet = 'UTF-8';
  14.  
  15. $body = file_get_contents('content.html');
  16. $mail->Username = 'xxxxxx@gmail.com';
  17. $mail->Password = 'xxxxxx';
  18. $mail->SetFrom('xxxxx@gmail.com', 'xxx');
  19. $mail->Subject = 'Отправка письма с GMAIL';
  20. $mail->MsgHTML($body);
  21. $address = 'xxxxx@gmail.com';
  22. $mail->AddAddress($address,'to_xxxx');
  23.  
  24. if($mail->Send()){
  25. echo 'Письмо отправлено';
  26. }else{
  27. echo $mail->ErrorInfo;
  28. }
  29.  
  30.  
  31. ?>
  32.  
  33. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement