Tuesday, June 28, 2011

Capifony: Send an email after deployment


First, thanks to @cordoval at the #symfony channel for suggesting me to use a symfony2 command to do this.

To use this command you must have the SwiftmailerBundle enabled. More info here.

This is a simple Symfony2 command to send an email, you should add it to a "Command" directory inside your bundle and replace the namespace to fit your project bundle:





The email body is just "test" but you can probably modified it you need to.


Test the new command by running the following:

php app/console capifony:sendemail emailfrom@server.com emailto@server.com subject


Finally, this task will run the capifony:sendemail command after the deployment is complete, be sure to add it to your Capifony script:




Want to learn more about Symfony2 console/command-line commands?

http://symfony.com/doc/current/cookbook/console.html


http://www.craftitonline.com/2011/06/calling-commands-within-commands-in-symfony2/

2 comments:

site said...

It won't really have effect, I consider like this.

Mbanugo Ginika said...

Really this Blogger is doing a great job in peoples life,I recommmend this site..http//www.unn.edu.ng to this site because of their undelaying efforts too.