smtp / pop3客户端如何读取smtp / pop3服务器发送给它们的[错误]消息(在delphi中)?

时间:2014-04-09 10:15:10

标签: delphi email indy

我的服务器端smtp和pop3事件使用ASender发送[错误]消息:TIdCommand如下:

ASender.Reply.SetReply(OK, 'message to send');

ASender.Reply.SetReply(ERR, 'error message to send');

所以我的问题是如何从smtp / pop3客户端读取此消息?

1 个答案:

答案 0 :(得分:2)

听起来你需要了解异常是如何运作的。

如果Connect()失败,则会引发异常。可能有几种不同的异常类型,包括EIdSocketError,其中包含套接字错误代码。

如果POP3 / SMTP命令失败,则会引发EIdRFCReplyError异常。该例外包含服务器的响应代码和消息。此信息也可在组件的LastCmdResult.CodeLastCmdResult.NumericCodeLastCmdResult.Text属性中使用。