- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 D7 + Indy 10 最新版本。
我的代码使用 TIdSMTP 发送电子邮件。我不断收到一些最终用户的“连接正常关闭”的消息,但电子邮件从未发送。
代码如下:
try
~~~~
~~~~
_idSMTP := TIdSmtp.Create;
with _idSMTP do
begin
Host := 'myhost';
Connect;
try
Send(_EmailMsg);
Result := True;
except
on E: Exception do
begin
MsgDlgErr(Self.Handle, E.Message)
end
end;
end;
finally
_idSMTP.Disconnect;
_idSMTP.Free;
end;
有什么建议吗?
最佳答案
在 http://www.swissdelphicenter.ch/en/showarticle.php?id=1 上阅读所有相关内容
EIdConnClosedGracefully is an exception signaling that the connection has been closed by the other side intentionally. This is not the same as a broken connection which would cause a connection reset error. If the other side has closed the connection and the socket is read or written to, EIdConnClosedGracefully will be raised by Indy. This is similar to attempting to read or write to a file that has been closed without your knowledge.
In some cases this is a true exception and your code needs to handle it. In other cases (typically servers) this is a normal part of the functioning of the protocol and Indy handles this exception for you. Even though Indy catches it, when running in the IDE the debugger will be triggered first. You can simply press F9 to continue and Indy will handle the exception, but the constant stopping during debugging can be quite annoying. In the cases where Indy catches the exception, your users will never see an exception in your program unless it is run from the IDE.
关于德尔福+印地 : Connection closed gracefully,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1085933/
我是一名优秀的程序员,十分优秀!