本文介绍了thinkphp5 swoole实现异步邮件群发(SMTP方式),分享给大家,具体如下:
1、环境说明
阿里云centos7
thinkphp5.0.11
swoole2.0.8
2、tp实现邮件发送
在项目下建立如下的文件目录:

其中SendMail.php是我们实际调用的发送邮件的文件。以下是主要代码:
namespace applibraryutilsmail;
use applibraryutilsmailPhpMailer;
use applibraryutilsmailSmtp;
use thinkLog;
error_reporting(E_STRICT);
date_default_timezone_set(Asia/Shanghai);
class SendMail
{
static function postmail($to,$subject = ,$body = ){
$mail = new PhpMailer();
$mail-
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...