Exemplo n.º 1
0
 /**
  * @param string $cc
  * @param string $to
  * @param \Conjoon\Data\Entity\Mail\MailAccountEntity $usedAccount The mail account
  *        which is most likely used to answer to this message
  *
  * @return array
  */
 protected function buildCcAddressList(array $cc, array $to, \Conjoon\Data\Entity\Mail\MailAccountEntity $usedAccount = null)
 {
     if (!$this->replyAll) {
         return array();
     }
     $accounts = $this->accountService->getMailAccounts();
     $filterAddressList = array();
     for ($i = 0, $len = count($accounts); $i < $len; $i++) {
         if ($usedAccount && $usedAccount->getId() == $accounts[$i]->getId()) {
             $filterAddressList[] = $accounts[$i]->getAddress();
             break;
         }
     }
     $merge = array();
     for ($i = 0, $len = max(count($cc), count($to)); $i < $len; $i++) {
         if (isset($cc[$i]) && !in_array($cc[$i]['address'], $filterAddressList)) {
             $merge[] = $cc[$i];
         }
         if (isset($to[$i]) && !in_array($to[$i]['address'], $filterAddressList)) {
             $merge[] = $to[$i];
         }
     }
     return $merge;
 }
 /**
  * @inheritdoc
  */
 protected function createConnectionForAccount(\Conjoon\Data\Entity\Mail\MailAccountEntity $mailAccount)
 {
     $connection = new $this->imapConnectionClassName(array('imapAdaptee' => new $this->imapAdapteeClassName()));
     $ssl = $mailAccount->getInboxConnectionType() == 'SSL' ? 'SSL' : ($mailAccount->getInboxConnectionType() == 'TLS' ? 'TLS' : false);
     $connection->connect(array('host' => $mailAccount->getServerInbox(), 'port' => $mailAccount->getPortInbox(), 'user' => $mailAccount->getUsernameInbox(), 'password' => $mailAccount->getPasswordInbox(), 'ssl' => $ssl));
     return $connection;
 }
Exemplo n.º 3
0
 /**
  * Returns a pooled connection.
  *
  * @param  \Conjoon\Data\Entity\Mail\MailAccountEntity $mailAccount
  *
  * @return \Conjoon\Data\Repository\Remote\RemoteConnection
  */
 protected function getConnectionFromPoolForAccount(\Conjoon\Data\Entity\Mail\MailAccountEntity $mailAccount)
 {
     $id = $mailAccount->getId();
     if (!isset($this->connectionPool[$id])) {
         $this->connectionPool[$id] = $this->createConnectionForAccount($mailAccount);
     }
     return $this->connectionPool[$id];
 }