Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "mail@gmail.com";
  5. $to = "mail@gmail.com";
  6. $subject = "Hi!";
  7. $body = "Hi,\n\nHow are you?";
  8.  
  9. $host = "ssl://smtp.gmail.com";
  10. $port = "465";
  11. $username = "myname"; //<> give errors
  12. $password 2twoxxxxass";
  13.  
  14. $headers = array ('From' => $from,
  15. 'To' => $to,
  16. 'Subject' => $subject);
  17. $smtp = Mail::factory('smtp',
  18. array ('host' => $host,
  19. 'auth' => true,
  20. 'username' => $username,
  21. 'password' => $password));
  22.  
  23. $mail = $smtp->send($to, $headers, $body);
  24.  
  25. if (PEAR::isError($mail)) {
  26. echo("<p>" . $mail->getMessage() . "</p>");
  27. } else {
  28. echo("<p>Message successfully sent!</p>");
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement