in reply to Avoiding mail loops

The usual way to do loop detection is to parse the Received headers. Look for your host appearing multiple times and you'll have spotted a loop.

-sam

Replies are listed 'Best First'.
Re^2: Avoiding mail loops
by varian (Chaplain) on Jun 16, 2007 at 08:03 UTC
    Using the Received field can lead to false positives when one uses multiple MTA's within the same domain.

    The proper method is to add a custom header to the email and for incoming emails detect if that particular header is present (if so, then you have a loop condition).

    Custom header names should start with 'X-' so as not to conflict with predefined names, e.g.

    X-Loop: cormanaz@domain.tld