| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/galaxynail.com/site/helpers/ |
Upload File : |
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require ROOT_SITE.'helpers/PHPMailer/src/PHPMailer.php';
require ROOT_SITE.'helpers/PHPMailer/src/SMTP.php';
require ROOT_SITE.'helpers/PHPMailer/src/Exception.php';
function sendmail($toList, $ccList, $bccList, $subject, $content)
{
date_default_timezone_set("Asia/Ho_Chi_Minh");
$mail = new PHPMailer(true);
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->CharSet = "utf-8";
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->Username = 'wwworgsvn@gmail.com'; // SMTP username
$mail->Password = 'kddlalpcuzyoxmkx'; // SMTP password
$mail->setFrom('ms.bichthuan@gmail.com', 'Galaxy Nails'); // TCP port to connect to
$mail->addReplyTo('ms.bichthuan@gmail.com', 'Galaxy Nails');
//send to email list
$toListArray = explode(";", $toList);
foreach($toListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addAddress($emailPair[1], $emailPair[0]);
}
}
//send cc email list
$ccListArray = explode(";", $ccList);
foreach($ccListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addCC($emailPair[1], $emailPair[0]);
}
}
//send bcc email list
$bccListArray = explode(";", $bccList);
foreach($bccListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addBCC($emailPair[1], $emailPair[0]);
}
}
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
//$mail->Body = 'This is the HTML message body <b>in bold!</b>';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->Subject = $subject ;
$mail->msgHTML($content);
if(!$mail->send()) {
log_message('error', $mail->ErrorInfo);
return false;
} else {
return true;
}
}
function send_mail_1($name,$from,$to,$subject,$message)
{
$mess =$message;
$headers = "From: ".$name." <".$from.">\n";
$headers .= "Reply-To: ".$name." <".$from.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=\"utf-8\"\n";
return @mail( $to, $subject, $mess, $headers );
}
function send($to,$subject,$message)
{
$CI = get_instance();
$mess =$message;
$contact_name = "=?UTF-8?B?".base64_encode($CI->config->item('contact_name')).'?=';
$headers = "From: ".$contact_name." <".$CI->config->item('contact_email').">\n";
$headers .= "Reply-To: ".$contact_name." <".$CI->config->item('contact_email').">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
return @mail( $to, "=?UTF-8?B?".base64_encode($subject).'?=', $mess, $headers );
}
function sendshare($nguoigui,$emailnguoigui,$emailnguoinhan,$subject,$message)
{
$CI = get_instance();
$mess =$message;
$nguoigui = "=?UTF-8?B?".base64_encode($nguoigui).'?=';
$headers = "From: ".$nguoigui." <".$emailnguoigui.">\n";
$headers .= "Reply-To: ".$nguoigui." <".$emailnguoigui.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
return @mail( $emailnguoinhan, "=?UTF-8?B?".base64_encode($subject).'?=', $mess, $headers );
}
function info_send_mail()
{
$CI = get_instance();
$CI->load->config('config_contact');
$mess = '<div>----------------------------</div>';
$mess .='<div><b>'.$CI->config->item('contact_name').'</b></div>';
$mess .='<div><b>Địa chỉ:</b> '.$CI->config->item('contact_address').'</div>';
$mess .='<div><b>Điện thoại:</b> '.$CI->config->item('contact_phone').' - '.$CI->config->item('contact_mobile').'</div>';
$mess .='<div><b>Email:</b> '.$CI->config->item('contact_email').'</div>';
$mess .='<div><b>Fax:</b> '.$CI->config->item('contact_fax').'</div>';
return $mess;
}
function send_mail($toList, $ccList, $bccList, $subject, $content)
{
date_default_timezone_set("Asia/Ho_Chi_Minh");
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->IsHTML(true) ;
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->CharSet="utf-8";
/*$mail->Port = 465;
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Host = 'mail.huynhgiatrading.com'; // Specify main and backup SMTP servers
$mail->Username = 'sales@huynhgiatrading.com'; //'sales@huynhgiatrading.com'; // SMTP username
$mail->Password = 'ViDlC4eIE';*/ //'ViDlC4eIE'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->Username = 'wwworgsvn@gmail.com'; // SMTP username
$mail->Password = '9gUXOAL7WjOZ';
$mail->AddReplyTo("ketoan@huynhgiatrading.com", "Công ty Huynh Gia Trading");
$mail->SetFrom("sales@huynhgiatrading.com", "Công ty Huynh Gia Trading");
//send to email list
$toListArray = explode(";", $toList);
foreach($toListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addAddress($emailPair[1], $emailPair[0]);
}
}
//send cc email list
$ccListArray = explode(";", $ccList);
foreach($ccListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addCC($emailPair[1], $emailPair[0]);
}
}
//send bcc email list
$bccListArray = explode(";", $bccList);
foreach($bccListArray as $emailPairString)
{
if (!empty($emailPairString))
{
$emailPair = explode("|", $emailPairString);
$mail->addBCC($emailPair[1], $emailPair[0]);
}
}
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
//$mail->isHTML(true); // Set email format to HTML
//$mail->Body = 'This is the HTML message body <b>in bold!</b>';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->Subject = $subject ;
$mail->msgHTML($content);
if(!$mail->send()) {
log_message('error', $mail->ErrorInfo);
return false;
} else {
return true;
}
}
?>