Quantcast
Channel: WO Blog » John
Viewing all articles
Browse latest Browse all 12

Sending emails in Silex via Swiftmailer spool

$
0
0

In Symfony2 it is relatively simple to send emails via a spool file, however in Silex we don’t have a console.

So we’ll have to make one and it’s very simple.

First you need to have the Symfony2 Console component setup in your Silex project.

The following console file is based on the example in this blog post and the Swiftmailer bundle console.

Make that file executable, or remove the first line and call it through the php cli.

You will also have to do a little change to your current Silex bootstrap file:

That should be it. This means you can now have a cron running to send emails and to the user they don’t have the wait while the SMTP server responds.


Viewing all articles
Browse latest Browse all 12

Trending Articles