config = parse_ini_file( dirname(dirname(dirname(__FILE__))) . "/config/config.ini", true); $this->sender = new \DT\ImapMailMerge\Imap\Sender; $this->imap = new \DT\ImapMailMerge\Imap\Connection; $this->imapProcessSafelist(); } /** * [imapProcessSafelist description] * @return [type] [description] */ public function imapProcessSafelist() { $mbox_pre = $this->imap; $mbox = $mbox_pre::$imapConn; $dirs = imap_list($mbox, $this->config['imapServer'], "*"); for ($i = count($this->config['safelist']); $i > 0; $i--) { $accountSlug = $this->config['safelist'][$i-1]; $accountDir = $this->config['imapServer'].'INBOX.'.$accountSlug; $accountError = $this->config['imapServer'].'INBOX.'.$accountSlug.'.error'; $accountSuccess = $this->config['imapServer'].'INBOX.'.$accountSlug.'.success'; $accountFail = $this->config['imapServer'].'INBOX.'.$accountSlug.'.fail'; $accountDirs = array($accountDir, $accountError, $accountSuccess, $accountFail); foreach ($accountDirs as $dir) { if (array_search($dir, $dirs) === false) { if (! imap_createmailbox($mbox, $dir)) { $this->sender->imapEmailLog( $this->config['adminEmail'], "IMAPMailMerge: Process SafeList Errored!", "Issue with the imap directories." ); } else { imap_subscribe($mbox, $dir); } } } } } }