Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $from = "examplewebsite.com";
  2.  
  3. $subject = "Hi!";
  4. $body = "Hi,nnHow are you?";
  5.  
  6. $host = "website.com ";
  7. $username = "[email protected]";
  8. $port = "465";
  9. $password = "password";
  10.  
  11. $headers = array(
  12. 'From' => $from,
  13. 'To' => $to,
  14. 'Subject' => $subject
  15. );
  16.  
  17. $smtp = Mail::factory(
  18. 'smtp',
  19. array (
  20. 'host' => $host,
  21. 'port' => $port,
  22. 'auth' => true,
  23. 'username' => $username,
  24. 'password' => $password
  25. )
  26. );
  27.  
  28. $mail = $smtp->send($to, $headers, $body);
  29.  
  30. if (PEAR::isError($mail)) {
  31. echo($mail->getMessage());
  32. }
  33. else {
  34. echo("Message successfully sent!");
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement