Exemplo n.º 1
0
 /**
  * Dispatch actions to take according to current bounce level
  */
 public function dispatch()
 {
     $this->findEmail();
     // If couldn't find the original email we cannot do anything
     if (!$this->email) {
         Tools::getLogger(__CLASS__)->warning('Bounced email found but cannot find corresponding record in database. Skipped.');
         return;
     }
     if ($this->bounceLevel != self::NEWSLETTER_NOT_A_BOUNCE) {
         if ($this->recipientList) {
             $this->recipientList->registerBounce($this->email->getRecipientAddress(), $this->bounceLevel);
         }
         $this->email->setBounceTime(new DateTime());
         $emailRepository = $this->objectManager->get('Ecodev\\Newsletter\\Domain\\Repository\\EmailRepository');
         $emailRepository->updateNow($this->email);
     }
     Tools::getLogger(__CLASS__)->info('Bounced email found with bounce level ' . $this->bounceLevel);
 }