/**
  * {@inheritdoc}
  */
 public function register(Container $app)
 {
     parent::register($app);
     $mailer = $app['config']->get('mailer');
     // Sender address, if set, all messages will be delivered with this address
     // as the "return path" address
     if (isset($mailer['sender_address'])) {
         if ($senderAddress = $mailer['sender_address']) {
             $app['swiftmailer.sender_address'] = $senderAddress;
         }
         unset($mailer['sender_address']);
     }
     // Gmail transport
     if ('gmail' === $mailer['transport']) {
         $mailer['transport'] = 'smtp';
         $mailer['host'] = 'smtp.gmail.com';
         $mailer['encryption'] = 'ssl';
         $mailer['auth_mode'] = 'login';
         $mailer['port'] = 465;
     }
     unset($mailer['transport']);
     // Set the mailer options
     $app['swiftmailer.options'] = $mailer;
     // Delivery address, if set, all email messages will be sent to this address
     // instead of being sent to their actual recipients
     if ($app['debug']) {
         $app->extend('swiftmailer.transport', function (\Swift_Transport $transport, $app) {
             if (null !== $app['swiftmailer.delivery_address']) {
                 $transport->registerPlugin(new \Swift_Plugins_RedirectingPlugin($app['swiftmailer.delivery_address']));
             }
             return $transport;
         });
     }
     $app['swiftmailer.delivery_address'] = null;
 }
 public function register(Application $app)
 {
     parent::register($app);
     $configMail = isset($app['app.config']['mail']) ? $app['app.config']['mail'] : array();
     $app['swiftmailer.options'] = $configMail;
     $app['app.mailer'] = $app->share(function ($app) use($configMail) {
         return new Mailer($app['mailer'], $app['twig'], $configMail, $app['logger']);
     });
 }
 /**
  * @param Application $app
  */
 public function register(Application $app)
 {
     $app['swiftmailer.options'] = array('host' => 'host', 'port' => '25', 'username' => 'username', 'password' => 'password', 'encryption' => null, 'auth_mode' => null);
     //
     parent::register($app);
 }