better-staridc-MNBT
1<?php
2include("../MPHX/common.php");
3include("./class.php");
4@header('Content-Type: text/html; charset=UTF-8');
5
6require '../mail/vendor/autoload.php';
7use PHPMailer\PHPMailer\PHPMailer;
8
9function sendEmail($to, $subject, $message) {
10 global $DB,$conf;
11 $mail = new PHPMailer(true);
12 try {
13 $mail->isSMTP();
14 $mail->Host = $conf['mailhost'];
15 $mail->SMTPAuth = true;
16 $mail->Username = $conf['mailuser'];
17 $mail->Password = $conf['mailpassword'];
18 $mail->SMTPSecure = 'ssl';
19 $mail->Port = $conf['mailport'];
20 $mail->CharSet = 'UTF-8';
21
22 $mail->setFrom($conf['mailuser'], 'MN系统');
23 $mail->addAddress($to);
24 $mail->Subject = $subject;
25 $mail->Body = $message;
26
27 return $mail->send();
28 } catch (Exception $e) {
29 return false;
30 }
31}
32?>