예제 #1
0
 public function clearmailAction()
 {
     try {
         $jsonData = $this->getRequest()->getContent();
         $data = $this->serializer->deserialize($jsonData, "Application\\API\\Canonicals\\Dto\\ThirdPartyEmailTransport", "json");
         $emailRepo = $this->getServiceLocator()->get('EMailSvc');
         $emailRepo->clearMail($data->mailapikey, $data->emailkeys);
     } catch (\Exception $ex) {
         error_log($ex->getMessage());
     }
     exit;
 }
예제 #2
0
 public function getMailFromServer()
 {
     if ($this->getMailApi == null || $this->mailApiKey == null) {
         return;
     }
     $data = new ThirdPartyEmailTransport();
     $data->mailapikey = $this->mailApiKey;
     $url = $this->getMailApi;
     $postString = $this->getJson($data);
     $content = $this->sendCurlRequest($url, $postString);
     $emails = $this->serializer->deserialize($content, "array<Application\\API\\Canonicals\\Entity\\Emails>", "json");
     $emailKeys = [];
     foreach ($emails as $email) {
         $emailKeys[] = $email->getEmailkey();
         // Has to be taken before the save, as it will update with new value
         $email->setHost($this->smtpDetails["SMTP_HOST"]);
         $email->setPort($this->smtpDetails["SMTP_PORT"]);
         $email->setAuth($this->smtpDetails["SMTP_AUTH"]);
         $this->emailsRepo->add($email);
     }
     return $emailKeys;
 }