Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
67
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. $to = "example@gmail.com";
  4. $subject = "Hi!";
  5. $body = "Hi,nnHow are you?";
  6.  
  7. $host = "website.com ";
  8. $username = "info@website.com";
  9. $port = "465";
  10. $password = "password";
  11.  
  12. $headers = array(
  13. 'From' => $from,
  14. 'To' => $to,
  15. 'Subject' => $subject
  16. );
  17.  
  18. $smtp = Mail::factory(
  19. 'smtp',
  20. array (
  21. 'host' => $host,
  22. 'port' => $port,
  23. 'auth' => true,
  24. 'username' => $username,
  25. 'password' => $password
  26. )
  27. );
  28.  
  29. $mail = $smtp->send($to, $headers, $body);
  30.  
  31. if (PEAR::isError($mail)) {
  32. echo($mail->getMessage());
  33. }
  34. else {
  35. echo("Message successfully sent!");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement