Guest User

Untitled

a guest
Nov 4th, 2017
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2. /**
  3. * Simple example script using PHPMailer with exceptions enabled
  4. * @package phpmailer
  5. * @version $Id$
  6. */
  7.  
  8. require 'class.phpmailer.php';
  9.  
  10. try {
  11. $mail = new PHPMailer(true); //New instance, with exceptions enabled
  12.  
  13. $to = "saxena@aspirehairrestoration.com";
  14. $mail->AddAddress($to);
  15. $mail->From = $_POST['email'];
  16. $mail->FromName = $_POST['name'];
  17. $mail->Subject = "Contact Form";
  18.  
  19. $body = preg_replace('/\\/','', $body); //Strip backslashes
  20. $mail->MsgHTML($body);
  21.  
  22. $mail->IsSMTP(); // tell the class to use SMTP
  23. $mail->SMTPAuth = true; // enable SMTP authentication
  24. $mail->Port = 25; // set the SMTP server port
  25. //$mail->Host = "saxena@aspirehairrestoration.com"; // SMTP server
  26. //$mail->Username = "name@domain.com"; // SMTP server username
  27. //$mail->Password = "password"; // SMTP server password
  28.  
  29. $mail->IsSendmail(); // tell the class to use Sendmail
  30. $mail->AddReplyTo("saxena@aspirehairrestoration.com");
  31. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  32. $mail->WordWrap = 80; // set word wrap
  33.  
  34.  
  35. $mail->IsHTML(true); // send as HTML
  36. $mail->Send();
  37. echo 'Thank You. Your form has been submitted';
  38. } catch (phpmailerException $e) {
  39. echo $e->errorMessage();
  40. }
  41.  
  42. ?>
Add Comment
Please, Sign In to add comment