Nạp tiền
mua source
Responsive image
Responsive image
Responsive image

Hướng dẫn dành cho bản self-hosted

Download file php_interface.zip giai nén vào folder /home/bitrix/www/bitrix/php_interface mở file init.php cấu hình các thông số mail smpt của bạn là có thể sử dụng

TỰ BẠN LÀM THEO HƯỚNG DẪN :

hàm function bxmail($to, $subject, $message, $additional_headers="", $additional_parameters="", MainMailContext $context = null){.....}

tại đường dẫn /home/bitrix/www/bitrix/modules/main/tools.php

Có kiểm tra xem trong code của bạn có hàm custom_mail không? nếu có thì sẽ dùng hàm custom_mail của bạn:

if(function_exists("custom_mail")){
return custom_mail($to, $subject, $message, $additional_headers, $additional_parameters, $context);
}

còn function custom_mail(param) bạn có thể tự viết riêng mình hoặc dùng trực tiếp hàm này do bitrix24 viết sẵn rồi chỉnh lại theo ý mình:

download thư viện phpmailer và giải nén vào folder

/home/bitrix/www/bitrix/php_interface/PHPMailer

Tao file /home/bitrix/www/bitrix/php_interface/init.php với nôi dung

function custom_mail($to, $subject, $message, $additional_headers, $additional_parameters){
$elements = imap_mime_header_decode($subject);
$title = '';
for ($i=0; $i $title .= $elements[$i]->text;
}

use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;

require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/Exception.php';
require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/PHPMailer.php';
require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/SMTP.php';

$mail = new PHPMailer;
$mail->SMTPDebug = true;
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->setLanguage('vn');

// Set mailer to use SMTP
$mail->Host = 'smtp.server.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;

$mail->From = 'email@from';
$mail->FromName = 'Test';
$mail->isHTML(true);
$mail->Subject = $text;
$mail->Body = $message;
$mail->addAddress($to);
if(!$mail->send()) {
echo $mail->ErrorInfo;
}
$mail->clearAddresses();
$mail->ClearCustomHeaders();
}

cấu hình các thông số smtp của server mail bạn vào là có thể gửi mail được

Hướng dẫn dành cho bản self-hosted:

Download file php_interface.zip giai nén vào folder /home/bitrix/www/bitrix/php_interface mở file init.php cấu hình các thông số mail smpt của bạn là có thể sử dụng

TỰ BẠN LÀM THEO HƯỚNG DẪN:

download thư viện PHPMailer tại https://github.com/PHPMailer/PHPMailer

giải nén và rename thành PHPMailer

tao file init.php với nôi dung:

function custom_mail($to, $subject, $message, $additional_headers, $additional_parameters){
$elements = imap_mime_header_decode($subject);
$title = '';
for ($i=0; $i $title .= $elements[$i]->text;
}

use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;

require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/Exception.php';
require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/PHPMailer.php';
require $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/PHPMailer/src/SMTP.php';

$mail = new PHPMailer;
$mail->SMTPDebug = true;
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->setLanguage('vn');

// Set mailer to use SMTP
$mail->Host = 'smtp.server.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;

$mail->From = 'email@from';
$mail->FromName = 'Test';
$mail->isHTML(true);
$mail->Subject = $text;
$mail->Body = $message;
$mail->addAddress($to);
if(!$mail->send()) {
echo $mail->ErrorInfo;
}
$mail->clearAddresses();
$mail->ClearCustomHeaders();
}

Chức năng viết bình luận chỉ giành cho người dùng đã đăng nhập !
Chức năng viết đánh giá chỉ giành cho người dùng đã download source này !