we/swiftmailerspool

一个扩展 Neos Swift Mailer 的异步邮件队列的 Flow 包

安装量: 2,059

依赖关系: 0

建议者: 0

安全: 0

星标: 2

关注者: 12

分支: 1

开放问题: 1

类型:typo3-flow-package

dev-master 2016-03-01 04:34 UTC

This package is not auto-updated.

Last update: 2024-09-21 17:42:11 UTC


README

本 Flow 包通过添加异步邮件队列扩展了 Neos Swift Mailer

配置

该包已预先配置为使用文件队列

WE:
  SwiftMailerSpool:
	spool:
	  type: 'Swift_FileSpool'
	  options: []
	  arguments:
		path: %FLOW_PATH_DATA%/SwiftMailerSpool/

使用方法

Neos Swift Mailer 不同,需要创建 \Swift_Message 对象而不是使用 \TYPO3\SwiftMailer\Message 对象。这是由于在 \FileSpool 中发生消息序列化问题时导致的,因为序列化的 \TYPO3\SwiftMailer\Message 不包括其私有父属性 \Swift_Message

过程与正常 SwiftMailer 库相同。

注入邮件接口,现在是一个 \Swift_SpoolTransport 对象

/**
 * @Flow\Inject
 * @var \TYPO3\SwiftMailer\MailerInterface
 */
protected $mailer;

创建消息

$mail = new \Swift_Message();

通过邮件发送消息

$this->mailer->send($mail);

现在,邮件已进入队列,可以通过命令真正发送

./flow swiftmailerspool:flush