As I work more and more with Symfony I’d like to share some of the things that take me a while to find out, hopefully making those operations easier for you.
Today it’s about e-mail. Almost every application uses e-mail, even if it’s just an activation e-mail for your account or link to reset a forgotten password. Normally you can easily use your hosting’s smtp server, but there are exceptions: for example if you need to use e-mail on a local machine or have a hosting provider that doesn’t allow or provide smtp access.
I had a situation like this and came up with the solution of
Using gmail as smtp server in symfony
The first step is to create a gmail account. It’s your own choice if you use your own, but you’re probably better off creating a seperate account to seperate things and to be sure that gmail doesn’t block your account for spamming if that ever happends accidently in your application.
The second step is to edit your factories yml:
# You can find more information about this file on the symfony website:
* Of course you need to add your account data in the username/password in the end
When I tested this I first got a response from g-mail with a strange status code telling me that the service was temporarily rejected. Don’t fear! After some hours to a day it vanished and I haven’t had any trouble since.