/** * Close mailbox * * @throws \SimpleMailReceiver\Exceptions\SimpleMailReceiverException * @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure. */ public function close() { try { //init the catching $this->exceptionThrower->start(); $success = imap_close($this->mailbox, CL_EXPUNGE); $this->exceptionThrower->stop(); return $success; } catch (\Exception $e) { throw new SimpleMailReceiverException("Error closing the connection" . $e->getMessage(), $e->getCode()); } }
/** * Connect to the mail Server */ public function connect() { $et = new ExceptionThrower(); $et->start(); //Do the connection $this->mailer = new Mailserver($this->protocol->connect($this->getConfig('username'), $this->getConfig('password')), $et); $et->stop(); return true; }