Re: [exim] filter and address book

Pàgina inicial
Delete this message
Reply to this message
Autor: Dennis Yurichev
Data:  
A: Mike Cardwell
CC: exim-users
Assumpte: Re: [exim] filter and address book
Mike Cardwell <exim-users@???> writes:

>> I have an address book, it's just plain text file, one email per line.
>> Is it possible to set up a filter, in order to move all incoming emails
>> from addresses not in address book, to another IMAP-accessible folder
>> named "not-in-address-book", so to leave emails only from "known"
>> addresses in inbox folder?
>
> The following in the DATA ACL would add an "AddressBook: true" header
> to your email if the sender envelope or From address are in your
> address book file.
>
> warn condition  = ${if or{{\
>                     ${lookup{$sender_address}lsearch{/path/to/file}{true}{false}}\
>                   }{\
>                     ${lookup{${address:$h_From:}}lsearch{/path/to/file}{true}{false}}\
>                   }}}\
>      add_header = AddressBook: true

>
> You could then use sieve or procmail or whatever to filter according to
> the existance/value of this header.


Thank you very much. I added this into .forward (dennis_inbox is an
account for all emails not in address book text file):

==========================================================================
warn condition  = ${if or{{\
                    ${lookup{$sender_address}lsearch{/home/dennis/address_book}{true}{false}}\
                  }{\
                    ${lookup{${address:$h_From:}}lsearch{/home/dennis/address_book}{true}{false}}\
                  }}}\
     deliver <dennis_inbox@localhost>
==========================================================================


But now I got this error:
==========================================================================
The userforward router encountered the following error(s):

  missing or malformed local part (expected word or "<") in the address
  "warn condition  = ${if or{{\
                    ${lookup{$sender_address}lsearch{/home/dennis/address_book}{true}{false}}\
                  }{\
                    ${lookup{${address:$h_From:}}lsearch{/home/dennis/address_book}{true}{false}}\
                  }}}\
     deliver <dennis_inbox@localhost>"


No valid addresses were generated.
==========================================================================

Anything else could I try?