Guest User

Untitled

a guest
Oct 5th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. // require PEAR:Mail
  4. require_once("Mail.php");
  5.  
  6. // parameter mail
  7. $host = "ssl://smtp.google.com";
  8. $port = 465;
  9. $email = "your_account@gmail.com";
  10. $pass = "your_gmail_password";
  11.  
  12. // buat instance mailer
  13. $smtp = Mail::factory('smtp',
  14. array ( 'host' => $host,
  15. 'port' => $port,
  16. 'auth' => true,
  17. 'username' => $email,
  18. 'password' => $pass ) );
  19.  
  20. // parameter pngiriman email
  21. $to = 'aaa@gmail.com';
  22. $cc = 'bbb@gmail.com';
  23. $from = 'your_account@gmail.com';
  24. $headers = array (
  25. 'From' => $from,
  26. 'To' => $to,
  27. 'Cc' => $cc,
  28. 'Reply-To' => $from,
  29. 'Date' => date(DATE_RFC822),
  30. 'Subject' => $subject,
  31. 'X-Mailer' => 'PHP/'.phpversion(),
  32. 'MIME-Version' => '1.0',
  33. 'Content-type' => "text/html; charset='utf-8'",
  34. 'Content-Transfer-Encoding' => '8bit'
  35. );
  36. $recipients = $to.','.$cc;
  37. $message = 'your message here';
  38.  
  39. // kirimkan email
  40. $mail = $smtp->send($recipients, $headers, $message);
  41.  
  42. ?>
Add Comment
Please, Sign In to add comment