Mailing List Archive

Exim filter
Hi,


I want to enable exim filter and move spam to spam directory, but my
config isn't work. Can you look what is wrong?


In exim.conf i have"

system_filter?????????? = /etc/exim4/exim.filter
system_filter_directory_transport = mysql_delivery


In exim.filter

# Exim filter
if $h_X-Spam-Score: contains "+++++" and
$h_to: contains "szpital.wloclawek.pl"
then

??? logfile /var/log/exim4/mainlog
??? logwrite "$tod_log $message_id Mail tagged as *** SPAM ***"
??? headers add "Old-Subject: $h_subject"
??? headers remove "Subject"
??? headers add "Subject: *** SPAM *** $h_old-subject"
??? headers remove "Old-Subject"
??? save /${home}/.Spam
??? finish

endif


In transport.conf:

#****************************
mysql_delivery:
#****************************
??????? driver????????????????? = appendfile
??????? directory?????????????? = ${lookup mysql { \
??????????????????????????????????????????????? SELECT
CONCAT("/var/mail/virtual/",? s.maildir, "Maildir") AS directory \
??????????????????????????????????????????????? FROM mailbox AS s \
??????????????????????????????????????????????? WHERE
s.local_part="${quote_mysql:$local_part}" \
??????????????????????????????????????????????? }}
??????? create_directory
??????? maildir_tag???????????? = ,S=$message_size
??????? maildir_format
??????? maildir_use_size_file
??????? group?????????????????? = EXIM_GROUP
??????? delivery_date_add
??????? envelope_to_add
??????? return_path_add
??????? mode??????????????????? = 0660
??????? quota?????????????????? = ${lookup mysql { \
??????????????????????????????????????????????? SELECT quota FROM mailbox \
??????????????????????????????????????????????? WHERE
username="${quote_mysql:$local_part@$domain}" \
???????????????????????????????????????????????? }}




--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Exim filter [ In reply to ]
* Tomasz Piotrowski via Exim-users [2018-06-29 15:29]:
> Hi,
>
>
> I want to enable exim filter and move spam to spam directory, but my config
> isn't work. Can you look what is wrong?

$home is never set in system filter.

> In exim.conf i have"
>
> system_filter           = /etc/exim4/exim.filter
> system_filter_directory_transport = mysql_delivery
>
>
> In exim.filter
>
> # Exim filter
> if $h_X-Spam-Score: contains "+++++" and
> $h_to: contains "szpital.wloclawek.pl"
> then
>
>     logfile /var/log/exim4/mainlog
>     logwrite "$tod_log $message_id Mail tagged as *** SPAM ***"
>     headers add "Old-Subject: $h_subject"
>     headers remove "Subject"
>     headers add "Subject: *** SPAM *** $h_old-subject"
>     headers remove "Old-Subject"
>     save /${home}/.Spam
>     finish
>
> endif
>
>
> In transport.conf:
>
> #****************************
> mysql_delivery:
> #****************************
>         driver                  = appendfile
>         directory               = ${lookup mysql { \
>                                                 SELECT
> CONCAT("/var/mail/virtual/",  s.maildir, "Maildir") AS directory \
>                                                 FROM mailbox AS s \
>                                                 WHERE
> s.local_part="${quote_mysql:$local_part}" \
>                                                 }}
>         create_directory
>         maildir_tag             = ,S=$message_size
>         maildir_format
>         maildir_use_size_file
>         group                   = EXIM_GROUP
>         delivery_date_add
>         envelope_to_add
>         return_path_add
>         mode                    = 0660
>         quota                   = ${lookup mysql { \
>                                                 SELECT quota FROM mailbox \
>                                                 WHERE
> username="${quote_mysql:$local_part@$domain}" \
>                                                  }}
>
>
>
>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/

--
-- Kirill Miazine <km@krot.org>

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Exim filter [ In reply to ]
* Kirill Miazine via Exim-users [2018-06-29 16:04]:
> * Tomasz Piotrowski via Exim-users [2018-06-29 15:29]:
> > Hi,
> >
> >
> > I want to enable exim filter and move spam to spam directory, but my config
> > isn't work. Can you look what is wrong?
>
> $home is never set in system filter.

and besides, your transport sets directory explicetly....

> > In exim.conf i have"
> >
> > system_filter           = /etc/exim4/exim.filter
> > system_filter_directory_transport = mysql_delivery
> >
> >
> > In exim.filter
> >
> > # Exim filter
> > if $h_X-Spam-Score: contains "+++++" and
> > $h_to: contains "szpital.wloclawek.pl"
> > then
> >
> >     logfile /var/log/exim4/mainlog
> >     logwrite "$tod_log $message_id Mail tagged as *** SPAM ***"
> >     headers add "Old-Subject: $h_subject"
> >     headers remove "Subject"
> >     headers add "Subject: *** SPAM *** $h_old-subject"
> >     headers remove "Old-Subject"
> >     save /${home}/.Spam
> >     finish
> >
> > endif
> >
> >
> > In transport.conf:
> >
> > #****************************
> > mysql_delivery:
> > #****************************
> >         driver                  = appendfile
> >         directory               = ${lookup mysql { \
> >                                                 SELECT
> > CONCAT("/var/mail/virtual/",  s.maildir, "Maildir") AS directory \
> >                                                 FROM mailbox AS s \
> >                                                 WHERE
> > s.local_part="${quote_mysql:$local_part}" \
> >                                                 }}
> >         create_directory
> >         maildir_tag             = ,S=$message_size
> >         maildir_format
> >         maildir_use_size_file
> >         group                   = EXIM_GROUP
> >         delivery_date_add
> >         envelope_to_add
> >         return_path_add
> >         mode                    = 0660
> >         quota                   = ${lookup mysql { \
> >                                                 SELECT quota FROM mailbox \
> >                                                 WHERE
> > username="${quote_mysql:$local_part@$domain}" \
> >                                                  }}
> >
> >
> >
> >
> > --
> > ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> > ## Exim details at http://www.exim.org/
> > ## Please use the Wiki with this list - http://wiki.exim.org/
>
> --
> -- Kirill Miazine <km@krot.org>
>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/

--
-- Kirill Miazine <km@krot.org>

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/