Aabhiaryan64

Untitled

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