gpt4 book ai didi

php - Symfony2 SwiftMailer - 如何在不等待服务器响应的情况下发送电子邮件

转载 作者:行者123 更新时间:2023-12-03 22:48:53 26 4
gpt4 key购买 nike

我正在使用 swiftmailer 发送一封大约 300 BCC 的电子邮件。
问题是,这样做时,我在客户端收到了 30 秒的超时。

在服务器端检查时,邮件发送正确,但发送所有这些电子邮件需要一些时间,因为邮件服务器处理大量电子邮件。

关于如何告诉 swiftmailer 不要等待服务器响应并呈现 View 的任何想法。

我查了 How to Spool Emails来自 coockbook,但我不认为我需要这样做。

知道我怎么能这样做吗?先感谢您。

最佳答案

来自 Symfony 文档:

# app/config/config.yml
swiftmailer:
# ...
spool: { type: memory }

When you are using the SwiftmailerBundle to send an email from a Symfony2 application, it will default to sending the email immediately. You may, however, want to avoid the performance hit of the communication between Swift Mailer and the email transport, which could cause the user to wait for the next page to load while the email is sending. This can be avoided by choosing to "spool" the emails instead of sending them directly. This means that Swift Mailer does not attempt to send the email but instead saves the message to somewhere such as a file. Another process can then read from the spool and take care of sending the emails in the spool. Currently only spooling to file or memory is supported by Swift Mailer.



http://symfony.com/doc/current/cookbook/email/spool.html

关于php - Symfony2 SwiftMailer - 如何在不等待服务器响应的情况下发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20514309/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com