SwiftMailer是否支持以Mail_Queue的方式发送异步邮件?

jul*_*n_c 6 swiftmailer mail-queue

我想使用sendgrid的SMTP服务器发送我的电子邮件,但是要连接到它们,而不是"网络时间",而是通过(简单)队列.

我知道PEAR的Mail_Queue可以让我这样做,但我可以使用SwiftMailer吗?

(SwiftMailer和Mail_Queue之间究竟有哪些区别?)

谢谢!

Ali*_*man 0

SwiftMailer 有“线轴”选项。Symfony 食谱中有详细信息。还有一些 Symfony 捆绑包可以通过数据库将该系统扩展为假脱机,例如WhiteOctoberSwiftMailerDBBundle

来自食谱:

# app/config/config.yml
swiftmailer:
    # ...
    spool:
        type: file
        path: /path/to/spool
Run Code Online (Sandbox Code Playgroud)

现在,当您的应用程序发送电子邮件时,它实际上不会被发送,而是添加到假脱机中。从假脱机发送消息是单独完成的。有一个控制台命令可以发送假脱机中的消息:

php app/console swiftmailer:spool:send --env=prod
Run Code Online (Sandbox Code Playgroud)