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;
}
}