1.这是我改好的文件,直接拿来用就行,下载https://download.csdn.net/download/mo3408/18265646后解压到extend里面:
2.这里以tp5版本为例,tp6的用法也一样,这里就不说了
3.下面的方法里面的变量都是在后台读出来的,根据自己需求改:
3.在公共方法里面写入发送邮件的方法:
use PHPMailer\PHPMailer;//php低版本
use tpemail\Mail;//php高版本
//发送邮件
function SendEmail($title, $Address, $body){
$conf=array();
$_confRes=db('conf')->select();
foreach ($_confRes as $k => $v) {
$conf[$v['ename']]=$v['va