Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail = new \PHPMailer(); // create a new object
- $mail->IsSMTP(); // enable SMTP
- $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
- $mail->SMTPAuth = true; // authentication enabled
- $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
- $mail->Host = 'smtp.gmail.com';
- $mail->Port = 465;
- $mail->Username = 'xxx';
- $mail->Password = 'xxx';
- $mail->SetFrom("web@gotamind.com", "gotamind");
- $mail->Subject = "FeedBack";
- $mail->Body = "Test message";
- $mail->AddAddress("pgafarov@dataarmor.ru");
- if(!$mail->Send()) {
- echo 'Mail error: '.$mail->ErrorInfo;
- }
- /*
- Результат:
- 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
- Mail error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement