Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. 1. Mở file \libraries\SEmail.php thêm hàm mới như sau:
  2.  
  3.     function send_smtp($address_to, $subject, $htmlcontent, $plaincontent = "", $attachment = array()) {
  4.         global $admin_name, $admin_email;
  5.         $PHPMailer = new PHPMailer;
  6.  
  7.         $PHPMailer->IsSMTP(); // telling the class to use SMTP
  8.         $PHPMailer->SMTPDebug = 0;                      // enables SMTP debug information (for testing)
  9.         // 1 = errors and messages
  10.         // 2 = messages only
  11.         $PHPMailer->SMTPAuth = true;                  // enable SMTP authentication
  12.         //$PHPMailer->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
  13.         $PHPMailer->Host = "smtp.domain.com"; // sets the SMTP server
  14.         //$PHPMailer->Port       = 465;                    // set the SMTP port for the GMAIL server
  15.         $PHPMailer->Username = "email address"; // SMTP account username
  16.         $PHPMailer->Password = "password";        // SMTP account password
  17.  
  18.         $PHPMailer->From = $admin_email;
  19.         $PHPMailer->FromName = $admin_name;
  20.         $PHPMailer->ClearAllRecipients();
  21.         $PHPMailer->AddAddress($address_to);
  22.         $PHPMailer->Subject = $subject;
  23.         $PHPMailer->Body = $htmlcontent;
  24.         $PHPMailer->AltBody = $plaincontent;
  25.         $PHPMailer->IsHTML(true);
  26.         while (list($k, $v) = each($attachment)) {
  27.             $PHPMailer->AddAttachment($v['file'], $v['nickname']);
  28.         }
  29.         $status = @$PHPMailer->Send();
  30.         $PHPMailer->ClearAddresses();
  31.         $PHPMailer->ClearAttachments();
  32.         return $status;
  33.     }
  34.  
  35.  
  36. 2. Mở file \include\functions\main.php
  37. Tìm function mailme và comment hàm này lại thay bằng hàm mới như sau:
  38. function mailme($sendto, $sendername, $from, $subject, $sendmailbody, $bcc = "") {
  39.     $subject = nl2br($subject);
  40.     $sendmailbody = nl2br($sendmailbody);
  41.     SEmail::send_smtp($sendto, $subject, $sendmailbody);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement