Advertisement
Guest User

Untitled

a guest
Aug 15th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "Web Master <webmaster@example.com>";
  5. $to = "Nobody <nobody@example.com>";
  6. $subject = "Test email using PHP SMTP\r\n\r\n";
  7. $body = "This is a test email message";
  8.  
  9. $host = "SMTPhostname";
  10. $username = "test@shareksa.com";
  11. $password = "jsprof900";
  12. $headers = array ('From' => $from,
  13. 'To' => $to,
  14. 'Subject' => $subject);
  15. $smtp = Mail::factory('smtp',
  16. array ('host' => $host,
  17. 'auth' => true,
  18. 'username' => $username,
  19. 'password' => $password));
  20.  
  21. $mail = $smtp->send($to, $headers, $body);
  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