Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. require_once "/usr/share/php/Mail.php";
  2.  
  3. send_mail($subject, $msg)
  4.  
  5. function send_mail ( $title, $info ) {
  6.  
  7. $from = "youraddress@gmail.com";
  8. $to = "whoitstwo@gmail.com";
  9. $subject = $title;
  10. $body = $info;
  11.  
  12. $host = "ssl://smtp.gmail.com";
  13. $port = "465";
  14. $username = "youremail@gmail.com";
  15. $password = "password";
  16.  
  17. $headers = array ('From' => $from,
  18. 'To' => $to,
  19. 'Subject' => $subject);
  20. $smtp = Mail::factory('smtp',
  21. array ('host' => $host,
  22. 'port' => $port,
  23. 'auth' => true,
  24. 'username' => $username,
  25. 'password' => $password));
  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