Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeCommand {
- /**
- * config:
- *
- * swiftmailer:
- * transport: smtp
- * encryption: ssl
- * auth_mode: login
- * host: smtp.example.com
- * username: your_username
- * password: your_password
- */
- public function execute(){
- $container = $this->getContainer();
- $mailer = $container->get('mailer'); // Swift_Mailer with smtp transport
- $queue = $container->get('mail-queue');
- while($mailMessage = $queue->get()){
- try{
- $mailer->send($mailMessage);
- } catch(\Exception $e){
- // some catch logic
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement