Advertisement
Guest User

Untitled

a guest
Dec 31st, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. //example.php
  2. <?php
  3. require 'phpmailer/PHPMailerAutoload.php';
  4.  
  5. $mail = new PHPMailer(); // create a new object
  6. $mail->IsSMTP(); // enable SMTP
  7. $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  8. $mail->SMTPAuth = true; // authentication enabled
  9. //$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
  10. $mail->Host = gethostbyname('smtp.gmail.com');
  11. $mail->Port = 587; // or 587
  12. $mail->IsHTML(true);
  13. $mail->Username = "myemail@gmail.com";
  14. $mail->Password = "gmailpass";
  15. $mail->SetFrom("myemail@gmail.com");
  16. $mail->Subject = "Test";
  17. $mail->Body = "hello";
  18. $mail->AddAddress("recipient@gmail.com");
  19. if(!$mail->Send()){
  20. echo "Mailer Error: " . $mail->ErrorInfo;
  21. } else {
  22. echo "Message has been sent";
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement