This commit is contained in:
2020-01-16 16:00:43 +01:00
6 changed files with 43 additions and 8 deletions

View File

@ -29,7 +29,7 @@ services:
public: true
tags: ['controller.service_arguments']
# add more services, or override services that need manual wiring
# AppBundle\Service\ExampleService:
# arguments:
# $someArgument: 'some_value'
swiftmailer.mailer.sendmail.transport:
class: Swift_SendmailTransport
public: true
arguments: ['/usr/sbin/sendmail -t']

View File

@ -1,4 +1,10 @@
#!/bin/bash
cd /var/www/html/ninegate
php bin/console swiftmailer:spool:send --message-limit=100 --env=prod
ninegate_activer_localmail=$(CreoleGet ninegate_activer_localmail non)
if [[ "$ninegate_activer_localmail" = 'oui' ]]
then
php bin/console swiftmailer:spool:send --message-limit=100 --env=prod --transport swiftmailer.mailer.sendmail.transport
else
php bin/console swiftmailer:spool:send --message-limit=100 --env=prod
fi

View File

@ -2,6 +2,7 @@
namespace Cadoles\CronBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
@ -12,7 +13,7 @@ use Symfony\Component\HttpFoundation\Response;
use Cadoles\CronBundle\Entity\Cron;
class MailCommand extends Command
class MailCommand extends ContainerAwareCommand
{
private $container;
private $em;
@ -40,6 +41,8 @@ class MailCommand extends Command
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
$mailer_host = $this->getContainer()->getParameter('cron_activate');
$this->writelnred('');
$this->writelnred('== Cron:Mail');
@ -48,6 +51,10 @@ class MailCommand extends Command
$command = $this->getApplication()->find("swiftmailer:spool:send");
$tbparameter["--message-limit"]=100;
$tbparameter["--env"]="prod";
if($mailer_host=="/usr/sbin/sendmail")
$tbparameter["--transport"]="swiftmailer.mailer.sendmail.transport";
$parameter = new ArrayInput($tbparameter);
try{
$returnCode = $command->run($parameter, $output);