Advertisement
Alex_Trubchaninov

Phpmailer 5.2.0 SMTP Gmail

Jun 30th, 2016
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2. require("/home/c/cm13906/public_html/testingphpmailer/PHPMailer_5.2.0/class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP();                                      // set mailer to use SMTP
  7. $mail->Host = "smtp.gmail.com";  // specify main and backup server
  8. $mail->SMTPDebug  = "1";
  9. $mail->SMTPAuth = "true";     // turn on SMTP authentication
  10. $mail->SMTPSecure = "ssl";
  11. $mail->Port = "465";
  12. $mail->Username = "testsmartbutton04@gmail.com";  // SMTP username
  13. $mail->Password = "fakepassword"; // SMTP password
  14.  
  15. $mail->From = "testsmartbutton04@gmail.com";
  16. $mail->FromName = "Alexey Trubchaninov";
  17.  
  18. $mail->AddAddress("alexey.trubchaninov@gmail.com");                  // name is optional
  19.  
  20.  
  21. $mail->WordWrap = 50;                                 // set word wrap to 50 characters
  22. $mail->IsHTML(true);                                  // set email format to HTML
  23.  
  24. $mail->Subject = "Delivery Request";
  25. $mail->Body    = "Hello, this is a test";
  26. $mail->AltBody = "Test";
  27.  
  28. if(!$mail->Send())
  29. {
  30.    echo "Message could not be sent. <p>";
  31.    echo "Mailer Error: " . $mail->ErrorInfo;
  32.    exit;
  33. }
  34.  
  35. echo "Message has been sent";
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement