3.7 SMTP Timeouts

When using polling functions, it is important to take into account possible delay, which can occur in SMTP transactions. Most often such delays are due to low network bandwidth, but sometimes remote sites impose them willingly, as a spam-fighting measure(5)

Mailfromd polling functions implement three distinct timeout values:

Connection timeout

Maximum time for establishing the initial TCP connection to the remote host. If the connection is not established within this time interval, the polling returns temp_failure.

Initial response timeout

Maximum time before receiving initial SMTP response from the remote host.

I/O timeout

Maximum amount of time for finishing an input/output operation with the remote SMTP server.

These three timeouts can be set using the following configuration file statements (see section Timeout Configuration):

 
connect-timeout interval;
initial-response-timeout interval;
io-timeout interval;

Here, interval is the time interval, expressed in usual time units(6), for example:

 
initial-response-timeout 1 minute 30 seconds;

The default values are:

 
connect-timeout 10 seconds;
initial-response-timeout 30 seconds;
io-timeout 3 seconds;

You will most certainly encounter some servers that deliberately delay issuing the initial SMTP reply (in particular, I have noted that most ‘CommuniGate Pro’ servers are guilty of this lame practice). The default initial-response-timeout value should be enough to cope with most of them. If you encounter a server that delays more than 30 seconds, you can raise the initial-response-timeout value. However, in this case, I'd rather recommend informing its admin that his server settings are not tolerable.

Footnotes

(5)

My private opinion is that such practice is completely lame.

(6)

See time interval specification, for its detailed description.