diff --git a/dicos/90_ninegate.xml b/dicos/90_ninegate.xml index ccd1a802..70a9254a 100644 --- a/dicos/90_ninegate.xml +++ b/dicos/90_ninegate.xml @@ -293,7 +293,10 @@ - + + + oui + @@ -391,6 +394,7 @@ ninegate_activate_websocket ninegate_noreply + ninegate_activer_localmail ninegate_smtphost ninegate_smtpport ninegate_smtpuser @@ -1137,7 +1141,18 @@ + + + oui + ninegate_smtphost + ninegate_smtpport + ninegate_smtpuser + ninegate_smtppwd + ninegate_smtpencryption + ninegate_smtpauthmode + + diff --git a/src/ninegate-1.0/app/config/services.yml b/src/ninegate-1.0/app/config/services.yml index cdb1c65a..a20d4907 100644 --- a/src/ninegate-1.0/app/config/services.yml +++ b/src/ninegate-1.0/app/config/services.yml @@ -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'] diff --git a/src/ninegate-1.0/scripts/ninegate-mail.sh b/src/ninegate-1.0/scripts/ninegate-mail.sh index c370fc46..ee534a97 100755 --- a/src/ninegate-1.0/scripts/ninegate-mail.sh +++ b/src/ninegate-1.0/scripts/ninegate-mail.sh @@ -1,4 +1,10 @@ #!/bin/bash cd /var/www/html/ninegate -php bin/console swiftmailer:spool:send --message-limit=100 --env=prod \ No newline at end of file +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 \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php b/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php index 37414b61..352431fb 100644 --- a/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php @@ -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); diff --git a/tmpl/ninegate-parameters.yml b/tmpl/ninegate-parameters.yml index 488ae2c2..afec4cbb 100644 --- a/tmpl/ninegate-parameters.yml +++ b/tmpl/ninegate-parameters.yml @@ -30,6 +30,12 @@ parameters: database_name: ninegate database_user: ninegate database_password: "changeme" +%if %%getVar("ninegate_activer_localmail", 'non') == "oui" + mailer_transport: sendmail + mailer_host: '/usr/sbin/sendmail' + mailer_user: ~ + mailer_password: ~ +%else mailer_transport: smtp %if %%is_defined("ninegate_smtphost") mailer_host: '%%ninegate_smtphost' @@ -39,5 +45,6 @@ parameters: mailer_host: 'localhost' mailer_user: '' mailer_password: '' +%end if %end if secret: ThisTokenIsNotSoSecretChangeIt diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml index d51bb12b..bc453b9e 100644 --- a/tmpl/ninegate-template.yml +++ b/tmpl/ninegate-template.yml @@ -408,7 +408,7 @@ parameters: mailer_port: '2525' mailer_encryption: null mailer_authmode: null - noreply: %%system_mail_to + noreply: %%ninegate_noreply %end if # Doctrine Configuration