Re: [Exim] Autoresponder except to some address...

Top Page
Delete this message
Reply to this message
Author: Robert Westendorp
Date:  
To: Phil Pennock
CC: exim-users
Subject: Re: [Exim] Autoresponder except to some address...
>On 2001-08-15 at 15:42 -0700, Robert Westendorp wrote:
>> Do you mean like this:
>> condition =${if eq {$localpart@$domain} {${lookup {$local_part@$domain}
>> lsearch {/usr/local/exim/noauto}}} {$value} fail }
>
>[ please don't top-quote ]
>
>You want to test the sender's address, not the recipient's address.
>
>$ echo >domains example.org
>$ exim -f fred@??? -be
>> $sender_address
>fred@???
>> $sender_address_local_part
>fred
>> $sender_address_domain
>example.org
>> ${lookup{$sender_address_domain} lsearch {domains} {yes}{no}}
>yes
><control-D>
>$ exim -f fred@??? -be
>> ${lookup{$sender_address_domain} lsearch {domains} {yes}{no}}
>no
>
>
>That's a crude and simple method. If you have many such domains, use a
>database-format, such as cdb. If you want more than just "is the domain
>in this list" then combine using "${if" and the boolean operators, as
>stated.
>
>To see how "condition" works, read section 20 of the Specification; it
>declines the director if the result is '0' or 'no' or 'false'. Using
>"fail" is probably a really bad idea, here.
>--
>I just felt a great disturbance in the net, as if millions of packets
>suddenly cried out in terror, and were suddenly discarded. -- amt


Great.. Think I got it working .. at least it seems to work fine in the
tests I ran. Here's how I got it to work in case someone else wants to know.

With this an Autoreply will only be sent if:

1. The sender_address is not the same as the recipient
2. The sender_address is not in the noauto file

This makes sure that users don't send to themselves and create a nasty loop
(I know that once and the once repat option help with this too) and allows
you to exclude addresses to an autoresponders, say a mailing list.

Transport:

vacation:
        driver = autoreply
        file = /usr/local/exim/autoreply/${local_part}.away
        user = nobody
        from = ${local_part}@${domain}
        to = $h_from:
        subject = "Autorespond Message - re:  $h_subject"
        once = /usr/local/exim/autorepeat
        once_repeat=60m


Director:

vacation_director:
driver=smartuser
condition = ${if and
{{!eq{$sender_address}{$local_part@$domain}}}{${lookup{$sender_address}
lsearch {/usr/local/exim/noauto} {no}{yes}}}}
require_files = /usr/local/exim/autoreply/${local_part}.away
transport = vacation
unseen

If there any comments, additions, whatever let me know .. I'd like to make a
nice robust autpresponder that is also versatile.