Beispiel #1
0
 /**
  * Execute the job
  *
  * @throws \Exception
  */
 public function execute()
 {
     $message = $this->getContent();
     if (!$this->emailService->send($message)) {
         throw new \Exception('snif');
     }
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $client = $serviceLocator->get(Mandrill::class);
     $config = $serviceLocator->get('Config');
     $config = $config['eoko']['mandrill'];
     $mailService = new MailService($client);
     if (isset($config['default']['subaccount'])) {
         $mailService->setDefaultSubaccount($config['default']['subaccount']);
     }
     if (isset($config['default']['from_email'])) {
         $mailService->setDefaultFromEmail($config['default']['from_email']);
     }
     if (isset($config['default']['from_name'])) {
         $mailService->setDefaultFromName($config['default']['from_name']);
     }
     if (isset($config['async'])) {
         $mailService->setAsync((bool) $config['async']);
     }
     if (isset($config['ip_pool'])) {
         $mailService->setIpPool($config['ip_pool']);
     }
     if (isset($config['send_at'])) {
         $mailService->setSendAt($config['send_at']);
     }
     return $mailService;
 }
Beispiel #3
0
 public function send()
 {
     return $this->service->send($this->message);
 }