โค้ด: เลือกทั้งหมด
$email_template = 'user_activate_passwd';
if ($config['email_enable']) {
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); // เรียกไฟล์ fuction เข้ามาทำงาน
$messenger = new \messenger(FALSE);
$messenger->template($email_template, $user_row['user_lang']); // $email_template คือรูปแบบเมลที่จะส่งไป สังเกตุได้จากไฟล์ภาษา > mail > ***.txt (ของมาตราฐานมันเอง) เเละ $user_row['user_lang'] คือภาษาที่ต้องการให้เมลที่จะส่งไปด้วยภาษาอะไร
$messenger->to($user_row['user_email'], $user_row['username']); // email ที่จะต้องการส่งไป เเละ username ที่จะส่งใช้งาน
$messenger->anti_abuse_headers($this->config, $this->user);
$messenger->assign_vars(array(
//'WELCOME_MSG' => htmlspecialchars_decode(sprintf($this->user->lang['WELCOME_SUBJECT'], $this->config['sitename'])),
'USERNAME' => htmlspecialchars_decode($user_row['username']),
'PASSWORD' => htmlspecialchars_decode($user_password),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_id}&k=$user_actkey"
));
// ตัวแปรที่จะส่งไปเเสดงยัง เมลที่เราได้เรียกใช้งานเทมเพลต
$messenger->send(NOTIFY_EMAIL);
}