Guest User

Untitled

a guest
Jul 11th, 2018
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. require("src/PHPMailer.php");
  2. require("src/Exception.php");
  3. $mail = new PHPMailer();
  4.  
  5. $mail->IsSMTP();
  6. $mail->Host = 'smtp.gmail.com';
  7. $mail->SMTPAuth = true; // turn on SMTP authentication
  8. $mail->Username = "gmail id"; // SMTP username
  9. $mail->Password = "mypassword"; // SMTP password
  10.  
  11. $mail->From = "opensourcesivaprakash@gmail.com";
  12. $mail->FromName = "Mailer";
  13. $mail->AddAddress("siva.sing.sivan@gmail.com", "Josh Adams");
  14. $mail->AddAddress("sp"); // name is optional
  15. //$mail->AddReplyTo("opensourcesivaprakash@gmail.com", "Information");
  16.  
  17. $mail->WordWrap = 50; // set word wrap to 50 characters
  18. //$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
  19. //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
  20. $mail->IsHTML(true); // set email format to HTML
  21.  
  22. $mail->Subject = "Here is the subject";
  23. $mail->Body = "This is the HTML message body in bold!";
  24. $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
  25.  
  26. if(!$mail->Send())
  27. {
  28. echo "Message could not be sent.
  29. ";
  30. echo "Mailer Error: " . $mail->ErrorInfo;
  31. exit;
  32. }
  33.  
  34. echo "Message has been sent";
Add Comment
Please, Sign In to add comment