We use TIdSMTPRelay to relay some messages. Sometimes the receiving email server will hang and just keep the connection open and our relayer never times out. Is there a way of giving it e.g. 5 mins to deliver the message and then give up?

有帮助吗?

解决方案

TIdSMTPRelay has ConnectTimeout and ReadTimeout properties. Indy does not have a SendTimeout property, so if the hang is occurring during a send rather than a connect/read, the only option would be to manually assign an SO_SNDTIMEO timeout on the underlying socket itself, such as by using the Socket.Binding.SetSocketOption() method in the OnConnect event.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top