Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Amazon's SES with Symfony2 and the Swiftmailer Bundle?

I'm hosting a site on Amazon's ec2 running a 64-bit version of CentOS.

The site has a simple Contact Us form that needs to send an email to several addresses when submitted (pretty basic).

Has anyone used Amazon's SES with Symfony2 and the Swiftmailer Bundle? And if so, do you recommend using SES or a more traditional email server for this type of task?

like image 550
user843058 Avatar asked Feb 07 '12 22:02

user843058


1 Answers

Sending mails through SES via Symfony2 didn't work out of the box for me because I had the spool option configured in my config.yml.

Another problem I stumbled upon was the port. Port 25 and 587 work perfect but 465 got me a timeout.

And it's important that you are using the right SMTP server, at first I was using us-east-1 (because I copied it from an example) although my SMTP actually was email-smtp.eu-west-1.amazonaws.com

So here's my current config:

parameters:
    mailer_transport: smtp
    mailer_host: email-smtp.eu-west-1.amazonaws.com
    mailer_user: AWS_ACCESS_KEY
    mailer_password: AWS_SECRET_KEY
    mailer_encryption: tls
    mailer_port: 587

swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    encryption: "%mailer_encryption%"
    port: %mailer_port%
    auth_mode:  login

I found the problem by executing the following on my command line:

php app/console swiftmailer:debug
like image 183
totas Avatar answered Oct 30 '22 14:10

totas