Does SwiftMailer support asynchronous mail sending the way Mail_Queue does?
Asked Answered
V

1

6

I want to send my emails using sendgrid's SMTP servers, but connecting to them, not at "Web-time", but via a (simple) queue.

I know PEAR's Mail_Queue can enable me to do that, but can I do it using SwiftMailer?

(What are exactly the fonctional differences between SwiftMailer and Mail_Queue?)

Thanks!

Varletry answered 10/6, 2011 at 15:14 Comment(0)
W
0

SwiftMailer has options for a 'spool'. There are details in the Symfony cookbook. There are also Symfony bundles that extend this system to spool via a database, such as the WhiteOctoberSwiftMailerDBBundle.

From the cookbook:

# app/config/config.yml
swiftmailer:
    # ...
    spool:
        type: file
        path: /path/to/spool

Now, when your app sends an email, it will not actually be sent but instead added to the spool. Sending the messages from the spool is done separately. There is a console command to send the messages in the spool:

php app/console swiftmailer:spool:send --env=prod
Wordsworth answered 29/8, 2014 at 10:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.