Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. require 'phpmailer/class.phpmailer.php';
  3. $mail = new PHPMailer;
  4.  
  5. $mail->IsSMTP();
  6. $mail->SMTPAuth = true;
  7. $mail->Host = "smtp.gmail.com";
  8. $mail->Port = 587;
  9. $mail->Username = "myusername@gmail.com";
  10. $mail->Password = "gmail_password";
  11.  
  12. $mail->From = 'donotreply@mydomain.com';
  13. $mail->FromName = 'Admin';
  14. $mail->AddAddress('Toreceiver@test.com', 'Receiver'); // Add a recipient
  15. $mail->IsHTML(true);
  16.  
  17. $mail->Subject = 'Here is the Subject';
  18. $mail->WordWrap = 50;
  19. $mail->Body = "This is in <b>Blod Text</b>";
  20. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  21.  
  22. if(!$mail->Send()) {
  23. echo 'Message could not be sent.';
  24. echo 'Mailer Error: ' . $mail->ErrorInfo;
  25. exit;
  26. }
  27.  
  28. echo 'Message has been sent';
  29. ?>
  30.  
  31. $mail->SetFrom('donotreply@mydomain.com', 'Admin');
  32.  
  33. $mail->SMTPDebug = 2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement