diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php b/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php index 5992b2faad..f6804143a7 100644 --- a/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php +++ b/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php @@ -34,10 +34,11 @@ class SendEmailCommand extends ContainerAwareCommand ->setDescription('Sends emails from the spool') ->addOption('message-limit', 0, InputOption::VALUE_OPTIONAL, 'The maximum number of messages to send.') ->addOption('time-limit', 0, InputOption::VALUE_OPTIONAL, 'The time limit for sending messages (in seconds).') + ->addOption('recover-timeout', 0, InputOption::VALUE_OPTIONAL, 'The timeout for recovering messages that have taken too long to send (in seconds).') ->setHelp(<<swiftmailer:spool:send command sends all emails from the spool. -php app/console swiftmailer:spool:send --message-limit=10 --time-limit=10 +php app/console swiftmailer:spool:send --message-limit=10 --time-limit=10 --recover-timeout=900 EOF ) @@ -58,6 +59,13 @@ EOF $spool->setMessageLimit($input->getOption('message-limit')); $spool->setTimeLimit($input->getOption('time-limit')); } + if ($spool instanceof \Swift_FileSpool) { + if (null !== $input->getOption('recover-timeout')) { + $spool->recover($input->getOption('recover-timeout')); + } else { + $spool->recover(); + } + } $sent = $spool->flushQueue($this->getContainer()->get('swiftmailer.transport.real')); $output->writeln(sprintf('sent %s emails', $sent));