我的服务器端smtp和pop3事件使用ASender发送[错误]消息:TIdCommand如下:
ASender.Reply.SetReply(OK, 'message to send');
或
ASender.Reply.SetReply(ERR, 'error message to send');
所以我的问题是如何从smtp / pop3客户端读取此消息?
答案 0 :(得分:2)
听起来你需要了解异常是如何运作的。
如果Connect()
失败,则会引发异常。可能有几种不同的异常类型,包括EIdSocketError
,其中包含套接字错误代码。
如果POP3 / SMTP命令失败,则会引发EIdRFCReplyError
异常。该例外包含服务器的响应代码和消息。此信息也可在组件的LastCmdResult.Code
,LastCmdResult.NumericCode
和LastCmdResult.Text
属性中使用。