How to send email from Symfony command with Swiftmailer and GmailBundle?

I’m running on Symfony 4.4.4, and I work with Swiftmailer & GmailBundle to send e-mail from Controller, this is working well.

But if I try to send a mail from a Symfony Command, the Swiftmailer send() method return 0. Which seems to be a common problem when no spool configuration is done.


swiftmailer.mailer.transport.gmail_api: '@AppServiceEmailGmailApiTransport'

And my GmailApiTransport is like this one: GmailApiTransport.php


 default_mailer: gmail_api
   transport: gmail_api

How can I implement the spool service to my gmail_api mailers ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *