Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 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-lite.php';
  9.  
  10. try {
  11. $mail = new PHPMailerLite(true); //New instance, with exceptions enabled
  12.  
  13. $body = file_get_contents('contents.html');
  14. $body = preg_replace('/\\\\/','', $body); //Strip backslashes
  15.  
  16. $mail->AddReplyTo("name@domain.com","First Last");
  17.  
  18. $mail->SetFrom('you@yourdomain.com', 'Your Name');
  19.  
  20. $to = "someone@example...com";
  21.  
  22. $mail->AddAddress($to);
  23.  
  24. $mail->Subject = "First PHPMailer Message";
  25.  
  26. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  27. $mail->WordWrap = 80; // set word wrap
  28.  
  29. $mail->MsgHTML($body);
  30.  
  31. $mail->IsHTML(true); // send as HTML
  32.  
  33. $mail->Send();
  34. echo 'Message has been sent.';
  35. } catch (phpmailerException $e) {
  36. echo $e->errorMessage();
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement