... swoole已经升级到4了,主要的特性是更好的支持协程,easyswoole也为了更好支持协程推出了es3。我本地环境是php7.2.9 centos7
在github下载最新的3.0的demo。地址为:https://github.com/easy-swoole/demo
这篇文章主要介绍了详解thinkphp5+swoole实现异步邮件群发(SMTP方式),具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文介绍了thinkphp5+swoole实现异步邮件群发(SMTP方式),分享给大家,具体如下:
1、环境说明阿里云centos7
thinkphp5.0.11
swoole2.0.8
2、tp实现邮件发送
在项目下建立如下的文件目录:
其中SendMail.php是我们实际调用的发送邮件的文件。以下是主要代码:
namespace app\library\utils\mail;
use app\library\utils\mail\PhpMailer;
use app\library\utils\mail\Smtp;
use think\Log;
error_reporting(E_STRICT);
date_default_timezone_set('Asia/Shanghai');
class SendMail
{
static function postmail($to,$subject = '',$body = ''){
$mail = new PhpMailer();
$mail->CharSet = config('mail.CharSet');
$mail->IsSMTP();
$mail->SMTPDebug = config('mail.SMTPDebug');
$mail->SMTPAuth = config('mail.SMTPAuth');
$mail->SMTPSecure = config('mail.SMTPSecur