Advertisement
Guest User

Untitled

a guest
Oct 25th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
  4.  
  5. set_include_path("." . PATH_SEPARATOR . ($UserDir = dirname($_SERVER['DOCUMENT_ROOT'])) . "/pear/php" . PATH_SEPARATOR . get_include_path());
  6. require_once "Mail.php";
  7.  
  8. $host = "ssl://imap.dreamhost.com";
  9. $username = "youremail@example.com";
  10. $password = "your email password";
  11. $port = "465";
  12. $to = "address_form_will_send_TO@example.com";
  13. $email_from = "youremail@example.com";
  14. $email_subject = "Subject Line Here: " ;
  15. $email_body = "whatever you like" ;
  16. $email_address = "reply-to@example.com";
  17.  
  18. $headers = array ('From' => $email_from, 'To' => $to, 'Subject' => $email_subject, 'Reply-To' => $email_address);
  19. $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
  20. $mail = $smtp->send($to, $headers, $email_body);
  21.  
  22.  
  23. if (PEAR::isError($mail)) {
  24. echo("<p>" . $mail->getMessage() . "</p>");
  25. } else {
  26. echo("<p>Message successfully sent!</p>");
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement