Advertisement
Guest User

Untitled

a guest
May 21st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. require("class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP(); // set mailer to use SMTP
  7. $mail->Host = "localhost"; // specify main and backup server
  8. $mail->SMTPAuth = true; // turn on SMTP authentication
  9. $mail->Username = "mygmail@gmail.com"; // SMTP username
  10. $mail->Password = "password_is_correct"; // SMTP password
  11.  
  12. $mail->From = "mygmail@gmail.com";
  13. $mail->FromName = "Harsh Patel";
  14. $mail->AddAddress("mygmail@gmail.com"); // name is optional
  15.  
  16. $mail->WordWrap = 50; // set word wrap to 50 characters
  17. $mail->IsHTML(true); // set email format to HTML
  18.  
  19. $mail->Subject = "Here is the subject";
  20. $mail->Body = "This is the HTML message body <b>in bold!</b>";
  21. $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
  22.  
  23. if(!$mail->Send())
  24. {
  25. echo "Message could not be sent. <p>";
  26. echo "Mailer Error: " . $mail->ErrorInfo;
  27. exit;
  28. }
  29.  
  30. echo "Message has been sent";
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement