Advertisement
Guest User

Untitled

a guest
Mar 21st, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. $mail = new \PHPMailer();  // create a new object
  2.         $mail->IsSMTP(); // enable SMTP
  3.         $mail->SMTPDebug = 1;  // debugging: 1 = errors and messages, 2 = messages only
  4.         $mail->SMTPAuth = true;  // authentication enabled
  5.         $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
  6.         $mail->Host = 'smtp.gmail.com';
  7.         $mail->Port = 465;
  8.         $mail->Username = 'xxx';
  9.         $mail->Password = 'xxx';
  10.         $mail->SetFrom("web@gotamind.com", "gotamind");
  11.         $mail->Subject = "FeedBack";
  12.         $mail->Body = "Test message";
  13.         $mail->AddAddress("pgafarov@dataarmor.ru");
  14.         if(!$mail->Send()) {
  15.             echo 'Mail error: '.$mail->ErrorInfo;
  16.         }
  17. /*
  18. Результат:
  19.  
  20. 2016-03-21 11:50:51 CLIENT -> SERVER: EHLO gotamind.com 2016-03-21 11:50:51 CLIENT -> SERVER: AUTH LOGIN 2016-03-21 11:50:51    CLIENT -> SERVER: d2ViQGdvdGFtaW5kLmNvbQ== 2016-03-21 11:50:51  CLIENT -> SERVER: a2lsbGVya2lsbDg4 2016-03-21 11:50:51 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 hx10sm24970418wjb.25 - gsmtp 2016-03-21 11:50:51  SMTP Error: Could not authenticate. 2016-03-21 11:50:51 CLIENT -> SERVER: QUIT 2016-03-21 11:50:51  SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
  21. Mail error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
  22. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement