Reputation: 921
I'm working in a symfony project (version 2.3.35) and I can't send emails in the production environment. Mails are sent perfectly in others environments except in production environment.
For instance, when I send an email by command line: this work:
php app/console swiftmailer:email:send --env=dev
But, this doesn't work:
php app/console swiftmailer:email:send --env=prod
The result is the same for both:
From: [email protected]
To: [email protected]
Subject: lorem ipsum
Body: lorem ipsum
Sent 1 emails
But with --env=prod option I don't get any email.
I've tried by setting the parameters.yml and config.yml hundred of times like in this post, but it's still not working.
app/config/config.yml
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_username%
password: %mailer_password%
spool: { type: memory }
app/config/parameters.yml
mailer_transport: gmail
mailer_host: smtp.gmail.com
mailer_username: [email protected]
mailer_password: apswd
Besides:
Any suggestion?
Thanks in advance.
EDIT: On the server where the project is stored (Ubuntu Server 12.04), I can send emails using the command line or by using a script php (with mail() function). Both work perfectly.
THE SOLUTION
I finally solved the problem by using:
php app/console cache:clear --env=prod
I don't know why, but this command has solved the problem. After this command the emails were sent perfectly from production environment.
Thanks to everybody.
Upvotes: 2
Views: 2013
Reputation: 934
Mails are sent perfectly in others environments except in production environment.
Try logging into the production server(s) and attempt to send an email from the command line.
You may need to work with the sysadmins to see if sending email is allowed from production systems.
You may need to work with the security/networking folks to see if the email port (typically port 25) is blocked.
Upvotes: 0