interactive-solutions / zf-email-in-background
1.2.4
2018-05-23 13:18 UTC
Requires
- interactive-solutions/zf-bernard: ^1.2.0
This package is auto-updated.
Last update: 2024-09-05 03:31:40 UTC
README
这是一个在RoaveEmailTemplates
和InteractiveSolutions\ZfBernard
之间的集成模块,它允许以非常简单的方法在后台发送电子邮件。
安装
通过composer简单安装
composer require interactive-solutions/zf-email-in-background
配置
无需配置,模块已为您处理
用法
假设您有访问bernard生产者InteractiveSolutions\Bernard\Producer
的权限,您只需要创建一个新的消息实例InteractiveSolutions\EmailInBackground\SendEmailMessage
示例
$args = [ 'activationKey' => 'helloWorld' ]; $producer->producer(new SendEmailMessage('email@google.com', 'user:registration', $args));
好了,您已成功创建了一个新消息,该消息将在后台任务中发送电子邮件
开发环境下的代码运行
在终端中运行以下命令以运行应用程序根目录下的代码
php public/index.php interactive-solutions:bernard:consume emails
生产环境下的代码运行
在生产环境中,您需要运行一个运行消费命令的docker容器,或者运行一个supervisord进程来运行它。
示例supervisord配置
[program:emails-in-background]
command=php <path to app root>/public/index.php interactive-solutions:bernard:consume emails
autostart=true
autorestart=true
stderr_logfile=<path to app root>/data/logs/supervisor/emails.err.log
stdout_logfile=<path to app root>/data/logs/supervisor/emails.out.log
user=www-data
group=www-data