title: Symfony 2: Swiftmailer not sending, no errors
body: <p>Ive recently migrated this website (made with Symfony 2) to a new server, and we decided to go with Google Apps to send emails. </p>
  
  <p>After some connection problems, Ive managed to set it up. I know is working because I can send email in the command line using:</p>
  
  <pre><code>app/console swiftmailer:email:send --subject="Test" --body="test" --from="xxxx" --to="yyyyy"
  </code></pre>
  
  <p>It works, the email is sent and I receive it immediately. </p>
  
  <p>The problem is: inside the site, is not working. Here is the code:</p>
  
  <pre><code>$mailer = $this-&gt;get('mailer');
  $message = $mailer-&gt;createMessage()
      -&gt;setSubject('Caderno Mágico: Redefinir Senha')
      -&gt;setFrom(array($this-&gt;container-&gt;getParameter('server_mail_address') =&gt; 'Caderno Mágico'))
      -&gt;setTo($usuario[0]-&gt;getEmail())
      -&gt;setBody($this-&gt;renderView('Emails/recuperar_conta.html.twig', array('username' =&gt; $usuario_selecionado-&gt;getUsername(), 'dados' =&gt; $hash)), 'text/html');
  $mailer-&gt;send($message);
  </code></pre>
  
  <p>Seems right, was working before. The user email there is the same email I used on the command line test. And the config used there is supposed to be the same that's being used when I send it though the command line:</p>
  
  <pre><code>swiftmailer:
      transport: smtp
      host:      smtp.gmail.com
      username:  yyyy
      password:  ******
      auth_mode: login
      port:      465
      encryption: ssl
      spool: { type: memory }
  
  swiftmailer.plugins.loggerplugin:
      class: 'Swift_Plugins_LoggerPlugin'
      arguments: ['@swiftmailer.plugins.loggerplugin.logger']
      tags: [{ name: 'swiftmailer.default.plugin' }]
  
  swiftmailer.plugins.loggerplugin.logger:
      class: 'Swift_Plugins_Loggers_EchoLogger'
      arguments: [false] 
  </code></pre>
  
  <p>There is no errors on any log, and the "send" method return true. It just dont works. (Ive tried with and without the spool: no difference). No email is sent.</p>
  
  <p>Ive set this "EchoLogger" plugin, and it works on the command line. I see can all messages and errors at the output, which helped me setting the config and fixing the connection problems. But that doest not seems to do anything when being executed by the server, I cant see any messages on the screen or in any logs.</p>
  
  <p>Ive even tried writing all the values in the code exactly like they are on my command line test, to rule out the possibility of something being wrong there, and still nothing:</p>
  
  <pre><code>$mailer = $this-&gt;get('mailer');
  $message = $mailer-&gt;createMessage()
      -&gt;setSubject('Test')
      -&gt;setFrom('yyyyy')
      -&gt;setTo('xxxxx')
      -&gt;setBody('test');
  $mailer-&gt;send($message);
  </code></pre>
  
  <p>So what can I do? What could be wrong? I dont even know how to debug this. Why would it work when run at the command line and fail silently when run inside the website? Is there any way or any place to see those EchoLogger messages when the code is being run at the server?</p>