elgentos / module-notifier-mail-adapter
Magento 邮件适配器,用于 MSP Notifier
dev-master
2019-12-12 09:09 UTC
Requires
- msp/module-notifier: ^0.1.6
This package is auto-updated.
Last update: 2024-09-12 19:26:23 UTC
README
适配器,用于使用 https://github.com/magespecialist/notifier/ 发送 Magento 模板邮件
描述
使用本模块,您可以通过定义模板 ID 和接收者电子邮件来发送 Magento 模板邮件。
通过额外的配置,您可以更改区域、store_id,甚至是在频道配置中定义的 from 和 from_name。还可以添加模板变量。
此适配器使用 MSP Notifier 发送电子邮件。在频道中,您可以使用即时发送或使用 MSP 队列。如果通过 foreach 循环发送大量电子邮件,则建议使用队列。
可以通过以下命令启动队列: bin/magento msp:notifier:queue:send
,因此可以将其添加到 crontab 中。
有关更多功能,请阅读完整的文档:https://github.com/magespecialist/notifier/wiki
代码
最小配置是
$config = [
'to' => 'info@elgentos.nl',
];
额外的配置可以是
$config = [
'to' => 'info@elgentos.nl',
'area' => 'frontend', // default
'store_id' => 0, //default
'template_vars' => [],
'from' => 'info@elgentos.nl', // is definend in channel config, so can be overridden
'from_name' => 'Elgentos', // is definend in channel config, so can be overridden
];
...
public function __construct(
Elgentos\NotifierMagentoMailAdapter\Api\SendMessageInterface $sendMessage
) {
$this->sendMessage = $sendMessage;
}
...
public function execute()
{
... // Your code
$config = [
'to' => 'info@elgentos.nl',
];
$this->sendMessage->execute('my_channel_code', 'magento_mail_template_id', $config);
... // Your code
}