emprit

email

Oct 17th, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 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 = "[email protected]";
  10. $pass = "*****";
  11.  
  12. // buat instance mailer
  13. class email{
  14.     public static function main_email(){
  15.         }
  16.     }
  17. $smtp = email::main_email('smtp',
  18.     array ( 'host' => $host,
  19.         'port' => $port,
  20.         'auth' => true,
  21.         'username' => $email,
  22.         'password' => $pass ) );
  23.  
  24. // parameter pngiriman email
  25. $to       = '[email protected]';
  26. $cc       = '[email protected]';
  27. $from     = '[email protected]';
  28. $subject     = 'testing email';
  29. $headers  = array (
  30.     'From' => $from,
  31.     'To' => $to,
  32.     'Cc' => $cc,
  33.     'Reply-To' => $from,
  34.     'Date' => date(DATE_RFC822),
  35.     'Subject' => $subject,
  36.     'X-Mailer' => 'PHP/'.phpversion(),
  37.     'MIME-Version' => '1.0',
  38.     'Content-type' => "text/html; charset='utf-8'",
  39.     'Content-Transfer-Encoding' => '8bit'
  40. );
  41. $recipients = $to.','.$cc;
  42. $message = 'bales yaa jika ada email yg terkirim dari saya :D';
  43.  
  44. // kirimkan email
  45. $mail = $smtp->send($recipients, $headers, $message);
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment