[Exim] Preventing Mail Loops with autoreplies, MTA on the ot…

Top Page
Delete this message
Reply to this message
Author: Marc Haber
Date:  
To: exim-users
Subject: [Exim] Preventing Mail Loops with autoreplies, MTA on the other side broken?
Hi!

I now have my autoreply filter working. However, it keeps generating
mail loops.

I have an old account at a site running PP. Let that account's e-mail
address be o@othersite. I have set up a .mailfilter that forwards
incoming e-mail to a-othersite@mysite which is in turn locally aliased
to a@mysite where the mail is finally delivered.

E-mail sent to o@othersite has the following headers when it arrives
in a@mysite mailbox:
|Return-path: <pp@othersite>
|Envelope-to: a-othersite@mysite
|Delivery-date: Wed, 01 Mar 2000 18:33:42 +0100
|Received: from mx.othersite ([1.2.3.4])
|    by myhost with esmtp (Exim 3.12 #1)
|    id 12QD0I-0002iK-00
|    for a-othersite@mysite; Wed, 01 Mar 2000 18:33:42 +0100
|Received: from shellmachine.othersite by mx.othersite (PP) with ESMTP;

|          Wed, 1 Mar 2000 18:33:25 +0100

|Received: from othersite by shellmachine.othersite
|          id <09251-0@???>; Wed, 1 Mar 2000 18:33:24 +0100

|Old-Return-Path: <postmaster@othersite>
|Old-Received: from mx.othersite by shellmachine (PP) with ESMTP; Wed, 1 Mar
|              2000 18:33:23 +0100

|Old-Received: from mysite by mx.othersite (PP) with SMTP; Wed,
|              1 Mar 2000 18:32:59 +0100

|From: postmaster@mysite
|To: o@othersite
|Subject: Test
|Date: Wed, 1 Mar 2000 17:33:22 +0000
|Message-ID: <created-by@othersite>
|Resent-Date: Wed, 1 Mar 2000 18:33:24 +0100
|Resent-From: o@othersite
|Resent-To: a-othersite@mysite
|Resent-Message-Id: <original>

My filter:
|# Exim filter <<== do not edit or remove this
|
|logfile "$home/.autoreply/log"
|
|if error_message then finish endif
|logwrite "original_local_part: $original_local_part"
|logwrite "From: $header_From:"
|if $original_local_part is "a-othersite" then
|  logwrite "doing autoreply"
|  mail log $home/.autoreply/$original_local_part.log
|       from "Marc Haber <expired-9947@???>"
|       expand file $home/.autoreply/$original_local_part.txt
|       return message

|endif

then proceeds to expand the text file and sends it back to o@othersite
which resends to my local machine which triggers the filter, expands
the text fiel and sends it back to o@othersite... Bang, a Loop that
isn't catched by either side.

I now have a bunch of questions.

Given that the original message's sender was postmaster@mysite, why
was the auto reply not sent to postmaster@mysite but rather to
o@otherside which supposedly is the envelope on the redirected
message? The docs say that if I omit to in a mail command, the
autoreply is sent to $reply_address which is either $from or
$reply-to.

In the case I log in to o@otherside and send myself a message. In that
case, the exim would behave correctly to autoreply to o@otherside,
causing the same mail loop. How would I prevent this?

Any hints will be appreciated.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29