Exim filter

Pagina: 1
Acties:

  • B-Man
  • Registratie: Februari 2000
  • Niet online
Ik heb nu een filter die wordt aangeroepen vanuit /etc/exim/config met
message_filter = ....
code:
1
2
3
4
5
6
7
8
9
10
# Exim filter

# Geen back-up van foutmeldingen
if error_message then finish endif

if first_delivery then
  if $h_to does not contain "mijndomein.nl" then
    unseen save /usr/local/mail/backup/mail/${domain:$h_to:} 0606
  endif
endif

Dit werkt goed, op een ding na. Als er meerdere adressen in het To: veld staan gaat het mis...
Ik zou eigenlijk een foreach-loop willen runnen op het To-veld, maar dat gaat niet.
if foranyaddress $h_to: ( $thisaddress matches ^\\d{8}@ ) then ...

When the overall condition is true, the value of $thisaddress in the commands that follow then is the last value it took on inside the loop. At the end of the if command, its value is reset to what it was before. It is best to avoid the use of multiple occurrences of foranyaddress, nested or otherwise, in a single if command, if the value of $thisaddress is to be used afterwards, because it isn't always clear what the value will be. Nested if commands should be used instead.
En ik wil dus voor ieder adres in het To of CC veld een backupje wegschrijven. Hoe pak ik dit aan ?