0

I'm trying to send emails using gmail configuration but I can't. I'm not having any errors; I also checked the symfony log files. Nothing crashed, but no emails are sent :( I also ran the swiftmailer:spool:send command (maybe the emails were in the spool) and as a result I received: sent 0 emails.

I'm using the dev environment, in my config_dev.yml:

swiftmailer:
    transport: gmail
    username:  myuser@gmail.com
    password:  mypass

In the controller(just for test):

$message = \Swift_Message::newInstance()
        ->setSubject('Hello Email')
        ->setFrom('send@example.com')
        ->setTo('myemail@mydomain.com')
        ->setBody(
        "some test body"
        )
;
$this->get('mailer')->send($message);

Thanks in advance

UPDATE: I switch to prod environment, same results: no errors... until i ran the command and I got this error:

[Swift_TransportException]                                                   
Connection could not be established with host smtp.gmail.com [Unable to fin  
d the socket transport "ssl" - did you forget to enable it when you configu  
red PHP? #50346848]                                                          

Then, I uncomment this line in the php.ini

extension=php_openssl.dll

but nothing, the same result :(

I also modified the memory to file in swiftmailer config and the email is there, in cache:

app\cache\prod\swiftmailer\spool

PS: I'm not behind any proxy

Oriam
  • 641
  • 10
  • 19

1 Answers1

0

Did you check the profiler (you can know if some emails were sent, or at least spooled)? Did you try in the prod environment ?

I remember a similar issue with Swiftmailer on a dev env in a project I did. To test it, I changed spool: { type: memory } to spool: { type: file } and I checked the mails in the dev cache directory.

AlixB
  • 1,208
  • 2
  • 10
  • 19
  • I did not try in the prod environment, i will. I will also change memory by file, thanks for the tip, I'll let you know – Oriam Jul 31 '14 at 16:27
  • @Oriam I just saw `I also modified the memory to file in swiftmailer config and the email is there, in cache:`. Did you use the spool command after that? – AlixB Jul 31 '14 at 18:19
  • Yes, i used after that. Now I'm not receiving any error(when i use the command), but the email is not sent. – Oriam Jul 31 '14 at 18:47