/** * Set the SMTP reply code. * * @param integer $smtpcode SMTP reply code. */ public function setSmtpCode($smtpcode) { $this->_enhancedcode = null; $this->code = 0; $this->_smtpcode = $smtpcode; /* Any code not listed here will get the details of the error message * as returned from the server. * Need to store $code/$message here because getCode()/getMessage() is * declared final in the parent class and we can not alter on-demand * at that location (darn). */ switch ($smtpcode) { case 450: $this->code = self::MAILBOX_UNAVAILABLE; $this->message = Horde_Smtp_Translation::t("Mailbox unavailable."); return; case 452: $this->code = self::INSUFFICIENT_STORAGE; $this->message = Horde_Smtp_Translation::t("Insufficient system storage."); return; case 454: $this->code = self::LOGIN_TLSFAILURE; $this->message = Horde_Smtp_Translation::t("Could not open secure TLS connection to the server."); return; case 530: $this->code = self::LOGIN_REQUIREAUTHENTICATION; $this->message = Horde_Smtp_Translation::t("Server requires authentication."); return; case 550: $this->code = self::MAILBOX_UNAVAILABLE; $this->message = Horde_Smtp_Translation::t("Message could not be delivered - the address was not found, is unknown, or is not receiving messages."); return; case 551: $this->code = self::UNKNOWN_LOCAL_USER; return; case 552: $this->code = self::OVERQUOTA; return; case 554: $this->code = self::DISCONNECT; $this->message = Horde_Smtp_Translation::t("Server is not accepting SMTP connections."); return; } $str_code = strval($smtpcode); switch ($str_code[1]) { case '0': $this->code = self::CATEGORY_SYNTAX; break; case '1': $this->code = self::CATEGORY_INFORMATIONAL; break; case '2': $this->code = self::CATEGORY_CONNECTIONS; break; case '5': $this->code = self::CATEGORY_MAILSYSTEM; break; } }
/** * Set the SMTP reply code. * * @param integer $code SMTP reply code. */ public function setSmtpCode($code) { $this->_smtpcode = $code; // Any code not listed here will get the details of the error message // as returned from the server. switch ($code) { case 450: $this->raw_msg = Horde_Smtp_Translation::r("Mailbox unavailable."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::MAILBOX_UNAVAILABLE; break; case 452: $this->raw_msg = Horde_Smtp_Translation::r("Insufficient system storage."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::INSUFFICIENT_STORAGE; break; case 454: $this->raw_msg = Horde_Smtp_Translation::r("Could not open secure TLS connection to the server."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::LOGIN_TLSFAILURE; break; case 530: $this->raw_msg = Horde_Smtp_Translation::r("Server requires authentication."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::LOGIN_REQUIREAUTHENTICATION; break; case 550: $this->raw_msg = Horde_Smtp_Translation::r("Message could not be delivered - the address was not found, is unknown, or is not receiving messages."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::MAILBOX_UNAVAILABLE; break; case 551: $this->code = self::UNKNOWN_LOCAL_USER; break; case 552: $this->code = self::OVERQUOTA; break; case 554: $this->raw_msg = Horde_Smtp_Translation::r("Server is not accepting SMTP connections."); $this->message = Horde_Smtp_Translation::t($this->raw_msg); $this->code = self::DISCONNECT; break; } }