Advertisement
Guest User

Untitled

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