Issue Bug Closed

#87648SendEmailCommand with wrong Parameter

Sascha Grötzner 02/04/19, 19:31 updated 05/07/19, 12:13

Description

Using swiftmail:spool:send with parameters produces an error “option does not accept a value”

./typo3/sysext/core/bin/typo3 swiftmailer:spool:send --message-limit=2
The "--message-limit" option does not accept a value.  
swiftmailer:spool:send [--message-limit] [--time-limit] [--recover-timeout]

->the class SendEmailCommand::configure uses wrong parameter:
is:

use Symfony\Component\Console\Input\InputArgument;
...
protected function configure()
    {
        $this
            ->setDescription('Sends emails from the spool')
            ->addOption('message-limit', null, InputArgument::REQUIRED, 'The maximum number of messages to send.')
            ->addOption('time-limit', null, InputArgument::REQUIRED, 'The time limit for sending messages (in seconds).')
            ->addOption('recover-timeout', null, InputArgument::REQUIRED, 'The timeout for recovering messages that have taken too long to send (in seconds).');
    }

should be: (InputArgument -> InputOption)

use Symfony\Component\Console\Input\InputOption;
...
protected function configure()
    {
        $this
            ->setDescription('Sends emails from the spool')
            ->addOption('message-limit', null, InputOption::VALUE_REQUIRED, 'The maximum number of messages to send.')
            ->addOption('time-limit', null, InputOption::VALUE_REQUIRED, 'The time limit for sending messages (in seconds).')
            ->addOption('recover-timeout', null, InputOption::VALUE_REQUIRED, 'The timeout for recovering messages that have taken too long to send (in seconds).');
    }

Reviews 2