email - 使用 OctoberCMS 进行电子邮件排队
问题描述
任何人都可以提供一些关于如何使用 OctoberCMS ajax 页面排队电子邮件的提示吗?
function sendRecipientMsg($dataset, $sendCounter, $recipients){
$template = $dataset['template'];
Mail::queue($template, $dataset, function($message) use($dataset, $recipients){
$message->to('piggy@teamprema.co.nz','MissPiggy');
$message->subject('Have a good day');
$message->from('us@prema.co.nz', 'Mike and Stephie');
$message->sender('us@prema.co.nz', 'Mike and Stephie');
trace_log('$message');
$message->cc($address, $name = null);
$message->bcc('systems@safe.org.nz', 'SAFE Campaigns Feedlots ECards');
});
}
此代码在我们使用 Mail::send 但不适用于 Mail::queue 时有效
非常欢迎任何帮助或提示
解决方案
在您的config/queue.php
文件中,您将哪个驱动程序设置为默认值?
例如:'default' => env('QUEUE_DRIVER', 'sync')
(如果您使用的是DotEnv,请检查.env
您的 docroot 中的文件)。
如果您正在使用同步,它应该立即发送,因为同步实际上仅用于开发并且仍然会阻塞。
如果您使用另一种方法,例如数据库,那么您必须确保您的队列配置为按照您的预期处理。
尝试运行php artisan queue:work
,然后触发您的 ajax 调用,它应该发送。
推荐阅读
- python-3.x - 在烧瓶中,我无法从 facebook messenger 获取会话变量
- python - python中的通配符列表匹配
- symfony - symfony 4.2 max_depth_handler 序列化器如何实现?
- typescript - 淘汰赛foreach循环绑定不起作用
- keras - 如何加载视频(图像序列)成为 CNN-LSTM 深度学习模型的数据输入?
- android - R.layout 未找到
- sql-server - 有效更新 980K 记录,其中行在组中具有最大值
- c# - 如何在 Xamarin.IOS 中实现进程间通信 (IPC)
- laravel - 渴望加载分页
- php - 使用木材在“发布”数组中未设置的问题