Guest User

Untitled

a guest
Jan 25th, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. $mail = new PHPMailer();
  2. $mail->IsSMTP(); // send via SMTP
  3. $mail->Host = "ssl://smtp.gmail.com";
  4. $mail->SMTPAuth = true; // turn on SMTP authentication
  5. $mail->Username = "mygmail@gmail.com"; // SMTP username
  6. $mail->Password = "mypassword"; // SMTP password
  7.  
  8. $webmaster_email = "from@gmail.com"; //Reply to this email ID
  9. $email ="to@gmail.com"; // Recipients email ID
  10. $name ="My Name"; // Recipient's name
  11.  
  12. $mail->From = $webmaster_email;
  13. $mail->Port = 465;
  14. $mail->FromName = "My Name";
  15. $mail->AddAddress($email,$name);
  16. $mail->AddReplyTo($webmaster_email,"My Name");
  17. $mail->WordWrap = 50; // set word wrap
  18. $mail->IsHTML(true); // send as HTML
  19. $mail->Subject = "subject";
  20. $mail->Body = "Hi,This is the HTML BODY "; //HTML Body
  21. $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
  22.  
  23. if(!$mail->Send()) {
  24. echo "Mailer Error: " . $mail->ErrorInfo;
  25. } else {
  26. echo "Message has been sent";
  27. }
Add Comment
Please, Sign In to add comment