Guest User

Untitled

a guest
Jan 21st, 2019
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. <?
  2. require("lib/class.phpmailer.php");
  3. $mail = new PHPMailer();
  4. $mail->IsSMTP();
  5. $mail->SMTPAuth = true;
  6. $mail->Mailer = "smtp";
  7. $mail->Host = "ssl://smtp.gmail.com";
  8. $mail->Port = 465;
  9. $mail->Username = "XXX@XXX.com"; // SMTP username
  10. $mail->Password = "XXXXXXX"; // SMTP password
  11. $mail->From = $email;
  12. $mail->AddAddress("XXXXXX@XXX.com", "XX XX XX");
  13. $mail->WordWrap = 50;
  14. $mail->IsHTML(true);
  15. $mail->Subject = "You have received feedback from your website!";
  16. $mail->Body = $message;
  17. $mail->AltBody = $message;
  18. if(!$mail->Send())
  19. {
  20. echo "Message could not be sent. <p>";
  21. echo "Mailer Error: " . $mail->ErrorInfo;
  22. exit;
  23. }
  24.  
  25. }
  26. ?>
  27.  
  28. SMTP Error: Could not connect to SMTP host. Message could not be sent.
  29.  
  30. Mailer Error: SMTP Error: Could not connect to SMTP host.
  31.  
  32. <?php
  33. require("phpmailer/class.phpmailer.php");
  34. $mail = new PHPMailer();
  35. $mail->IsSMTP(); // send via SMTP
  36. IsSMTP(); // send via SMTP
  37. $mail->SMTPAuth = true; // turn on SMTP authentication
  38. $mail->Username = "username@gmail.com"; // SMTP username
  39. $mail->Password = "password"; // SMTP password
  40. $webmaster_email = "username@doamin.com"; //Reply to this email ID
  41. $email="username@domain.com"; // Recipients email ID
  42. $name="name"; // Recipient's name
  43. $mail->From = $webmaster_email;
  44. $mail->FromName = "Webmaster";
  45. $mail->AddAddress($email,$name);
  46. $mail->AddReplyTo($webmaster_email,"Webmaster");
  47. $mail->WordWrap = 50; // set word wrap
  48. $mail->IsHTML(true); // send as HTML
  49. $mail->Subject = "This is the subject";
  50. $mail->Body = "This is the HTML BODY "; //HTML Body
  51. $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
  52. if(!$mail->Send())
  53. {
  54. echo "Mailer Error: " . $mail->ErrorInfo;
  55. }
  56. else
  57. {
  58. echo "Message has been sent";
  59. }
  60. ?>
Add Comment
Please, Sign In to add comment