vendor/thelia/core/lib/Thelia/Action/MailingSystem.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Thelia package.
  4.  * http://www.thelia.net
  5.  *
  6.  * (c) OpenStudio <info@thelia.net>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Thelia\Action;
  12. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  13. use Thelia\Core\Event\MailingSystem\MailingSystemEvent;
  14. use Thelia\Core\Event\TheliaEvents;
  15. use Thelia\Model\ConfigQuery;
  16. class MailingSystem extends BaseAction implements EventSubscriberInterface
  17. {
  18.     public function update(MailingSystemEvent $event): void
  19.     {
  20.         if ($event->getEnabled()) {
  21.             ConfigQuery::enableSmtp();
  22.         } else {
  23.             ConfigQuery::disableSmtp();
  24.         }
  25.         ConfigQuery::setSmtpHost($event->getHost());
  26.         ConfigQuery::setSmtpPort($event->getPort());
  27.         ConfigQuery::setSmtpEncryption($event->getEncryption());
  28.         ConfigQuery::setSmtpUsername($event->getUsername());
  29.         ConfigQuery::setSmtpPassword($event->getPassword());
  30.         ConfigQuery::setSmtpAuthMode($event->getAuthMode());
  31.         ConfigQuery::setSmtpTimeout($event->getTimeout());
  32.         ConfigQuery::setSmtpSourceIp($event->getSourceIp());
  33.     }
  34.     /**
  35.      * {@inheritDoc}
  36.      */
  37.     public static function getSubscribedEvents()
  38.     {
  39.         return [
  40.             TheliaEvents::MAILING_SYSTEM_UPDATE => ['update'128],
  41.         ];
  42.     }
  43. }