Advertisement
Guest User

Fungsi baru

a guest
Aug 21st, 2017
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. include("include/config.php");
  4.  
  5. error_reporting(E_ALL);
  6.  
  7. function mailer($sendto,$sendername,$from,$subject,$sendmailbody,$bcc="",$replyto="")
  8. {
  9.     global $config;
  10.     require($config['basedir'].'/mailer/PHPMailerAutoload.php');
  11.  
  12.     $mailer = new PHPMailer;
  13.     $mailer->isSMTP();
  14.     $mailer->Host = 'smtp.gmail.com';
  15.     $mailer->SMTPAuth = true;
  16.     $mailer->Username = 'noreply@p-store.net';
  17.     $mailer->Password = 'plend123';
  18.     $mailer->SMTPSecure = 'tls';
  19.     $mailer->Port = 587;
  20.     $mailer->isHTML(true);
  21.     $mailer->setFrom($from, $sendername);
  22.     $mailer->addAddress($sendto);
  23.     if($bcc != "")
  24.     {
  25.         $mailer->addBCC($bcc);
  26.     }
  27.     if($replyto != "")
  28.     {
  29.         $mailer->addReplyTo($replyto);
  30.     }
  31.    
  32.     $mailer->Subject = $subject;
  33.     $mailer->Body = $sendmailbody;
  34.    
  35.     $status = @$mailer->send();
  36.     $mailer->ClearAllRecipients();
  37.     $mailer->ClearAddresses();
  38.     $mailer->ClearAttachments();
  39.     return $status;
  40. }
  41.  
  42. $sendto = 'xxxxxxx@gmail.com';
  43. $sendername = 'Sender Name';
  44. $from = $config['site_email'];
  45. $replyto = 'xxxxx@company.com';
  46. $subject = "Subject";
  47. $sendmailbody = "Body";
  48. mailer($sendto,$sendername,$from,$subject,$sendmailbody,$bcc="",$replyto);
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement