PHP - Mailer Code


/ Published in: PHP
Save to your folder(s)

Advance Mail function using PHP Mailer Class


Copy this code and paste it in your HTML
  1. <?php
  2. require("class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP(); // send via SMTP
  7. $mail->Host = "smtp.domain.com"; // SMTP servers
  8. $mail->SMTPAuth = true; // turn on SMTP authentication
  9. $mail->Username = "[email protected]"; // SMTP username
  10. $mail->Password = "password"; // SMTP password
  11.  
  12. $mail->From = "[email protected]";
  13. $mail->FromName = "Name";
  14. $mail->AddAddress("[email protected]","Name");
  15. $mail->AddReplyTo("[email protected]","Your Name");
  16.  
  17. $mail->WordWrap = 50; // set word wrap
  18.  
  19. $mail->IsHTML(true); // send as HTML
  20.  
  21. $mail->Subject = "Here is the subject";
  22. $mail->Body = "This is the <b>HTML body</b>";
  23. $mail->AltBody = "This is the text-only body";
  24.  
  25. if(!$mail->Send())
  26. {
  27. echo "Message was not sent <p>";
  28. echo "Mailer Error: " . $mail->ErrorInfo;
  29. }
  30.  
  31. echo "Message has been sent";
  32.  
  33. ?>

URL: http://www.vpsdiscussions.com/index.php/topic,111.0.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.