Configure MailCatcher for Symfony2
Using MailCatcher in combination with Symfony2 on your development machine will make it easy to check the e-mails you are sending out.
What is MailCatcher
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface.
Install MailCatcher
Install MailCatcher dependecies, sqlite and ruby.
Install the MailCatcher Ruby gem
Start MailCatcher
This will start up MailCatcher, but only when you trigger this command. I thinks it’s more convenient to start MailCatcher with Upstart.
Create an upstart script
Create and edit file /etc/init/mailcatcher.conf
.
After configuring this upstart config file, you’re able to use the following set of commands:
Run sudo service mailcatcher start
after that you should be able to visit the web interface on http://10.0.0.2:1080
(replace 10.0.0.2
with the ip of your development machine).
Configure Symfony2
In order to re-route all mail traffic from Swiftmailer to MailCatcher, you should adjust your config_dev.yml
file with the following settings:
And Symfony2 profiler’ mail item?
Yes, that’s still working and for me personal this is a much faster way to check and validate emails and their content.
Thanks for reading
Feel free to leave a comment if you have remarks or like this post