Guest User

Untitled

a guest
Aug 8th, 2018
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. SMTP Gmail Server SSL Error
  2. $mail = new phpmailer;
  3. $mail->IsSMTP(); // telling the class to use SMTP
  4. $mail->SMTPDebug = 1;// enables SMTP debug information (for testing)
  5. $mail->SMTPAuth = true; // enable SMTP authentication
  6. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  7. $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  8. $mail->Port = 465; // set the SMTP port for the GMAIL server
  9. $mail->Username = "un"; // GMAIL username
  10. $mail->Password = "pwd"; // GMAIL password
  11. $mail->SetFrom('test@gmail.com', 'Bharanidharan');
  12. $mail->AddReplyTo("test@gmail.com","Vishal Kumar");
  13. $mail->AddAddress("test@gmail.com","Bharani");
  14. $mail->Subject = "Hey, check out";
  15. $body = "hey, check email";
  16. $mail->MsgHTML($body);
  17. $address = "test@gmail.com";
  18. $mail->AddAddress($address, "test");
  19. if(!$mail->Send())
  20. {
  21. echo "Mailer Error: " . $mail->ErrorInfo;
  22. }
  23. else
  24. {
  25. echo "Message has been sent";
  26. }
Add Comment
Please, Sign In to add comment