Advertisement
Guest User

Untitled

a guest
Oct 5th, 2017
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "mmccabe1993@gmail.com";
  5. $to = "mmccabe1993@gmail.com";
  6. $subject = "Email Test...";
  7. $body = "What's up.\n\n\nSent via PHP.";
  8.  
  9. $host = "smtp.gmail.com";
  10. $port = "465";
  11. $username = "mmccabe1993@gmail.com";
  12. $password = "wh4t1smyp455w0rd";
  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.                             )
  24.                     );
  25. $mail = $smtp->send($to, $headers, $body);
  26. if ( PEAR::isError($mail) )
  27.     echo $mail->getMessage() + "<br>";
  28. else
  29.     echo "Mail successfully sent!<br>";
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement