Wandering Thoughts archives

2010-08-28

The different between an SMTP proxy and a SMTP relay

This is one of those distinctions that is both obvious and obscure.

SMTP proxies and SMTP relays both sit between two machines; call them the outside client and the inside mail server, as in the case of our external mail gateway.

A SMTP proxy is synchronous. When it gets a SMTP connection from the outside client, it establishes an SMTP conversation with the inside mail server. When it receives a SMTP command from the outside client, it applies its own processing (if any), sends the command on to the inside mail server, and only gives a positive reply to the outside client if the inside mail server also accepts it. Of course a filtering SMTP proxy can reject a SMTP command without even bothering the inside mail server if it wants, and it can filter and modify the commands it sends onward (and the replies it gets back).

('Command' here is broadly construed; for example, all of the message body might be seen as a single command.)

A SMTP relay is asynchronous. Even if it immediately starts a SMTP conversation with the inside mail server, it won't delay replies to the outside client's SMTP commands until it has answers from the inside mail server. Most SMTP relays don't even start talking to the inside mail server until they've had a full conversation with the outside client.

SMTP proxies are in many ways simpler than SMTP relays, because they never becomes responsible for messages themselves; responsibility passes directly from the outside client to the inside mail server, because the SMTP proxy never tells the outside client that the mail has been accepted until the inside mail server has also accepted it. A SMTP proxy does not have to reliably save messages to disk in case they can't be immediately delivered or the system crashes, it does not have to maintain and retry queues of pending messages, and it has the important property (from an antispam perspective) that it never has to generate and send a bounce message and thus it never has to worry about the accept-then-bounce issue.

Because a SMTP relay actively takes responsibility for messages, it does have to deal with all of those issues. (It may chose to break the rules, in which case mail can silently vanish.)

Essentially all MTAs are SMTP relays, because that's their purpose; they accept and transport and store email for people. Very few are capable of acting as SMTP proxies, because this is a rare case for them.

Conversely, anti-spam filters that you talk to using SMTP are generally SMTP proxies, because they don't want to deal with all of the extra complexity of being an SMTP relay (especially the the accept-then-bounce issue).

spam/SMTPProxyVersusRelay written at 01:19:41; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.