Guest User

Untitled

a guest
Nov 6th, 2018
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. require_once "Mail.php";
  2. $from = "myemail@email.com";
  3. $to = "test@email.com";
  4.  
  5. $subject = "Test";
  6. $body = "Hello";
  7. $host = "mail.mysite.com";
  8. $port = "myport";
  9. $username = "myemail@email.com";
  10. $password = "my_password";
  11. $headers = array ('From' => $from,
  12. 'To' => $to,
  13. 'Subject' => $subject);
  14. $smtp = Mail::factory('smtp',
  15. array ('host' => $host,
  16. 'port' => $port,
  17. 'auth' => true,
  18. 'username' => $username,
  19. 'password' => $password));
  20. $mail = $smtp->send($to, $headers, $body);
  21. if (PEAR::isError($mail)) {
  22. echo($mail->getMessage());
  23. } else {
  24. echo("success!");
  25. }
Add Comment
Please, Sign In to add comment