Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "Sandra Sender <xyx@gmail.com>";
  5. $to = "Ramona Recipient <xyz@gmail.com>";
  6. $subject = "Hi!";
  7. $body = "Hi,nnHow are you?";
  8.  
  9. $host = "ssl://smtp.gmail.com";
  10. $username = "xyz@gmail.com";
  11. $password = "XXXXXXXXXXXX";
  12.  
  13. $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
  14. $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true,
  15. 'username' => $username,
  16. 'password' => $password));
  17.  
  18. $mail = $smtp->send($to, $headers, $body);
  19.  
  20. if (PEAR::isError($mail)) {
  21. echo("<p>" . $mail->getMessage() . "</p>");
  22. } else {
  23. echo("<p>Message successfully sent!</p>");
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement