Re: [exim] Run a Program from within Exim

Top Page
Delete this message
Reply to this message
Author: Lena
Date:  
To: exim-users
Subject: Re: [exim] Run a Program from within Exim
> From: David Cunningham

> I tried adding a condition to my local_delivery transport
> that looked like this:
>
> condition = {run echo
> "/var/spool/maildirs/${substr_0_10:$tod_log}/${domain}/${local_part}/Maildir"
> >> /dev/shm/temp.file}{0}{1}


The ">>" is a shell operator. ${run doesn't use shell by default.
An example from my config:

LIM = 100
PERIOD = 1h
WARNTO = abuse@???
DIR = /var/spool/exim
EXIMBINARY = /usr/local/sbin/exim
SHELL = /bin/sh
...
acl_check_rcpt:
...
  accept authenticated = *
        set acl_m_user = ${sg{$authenticated_id}{\N\W.*$\N}{}}
        condition = ${if exists{DIR/blocked_users}}
        condition = ${if eq{${lookup{$acl_m_user}lsearch\
                    {DIR/blocked_users}{1}{0}}}{1}}
        control = freeze/no_tell
        add_header = X-Authenticated-As: $acl_m_user


  accept authenticated = *
        !verify = recipient/defer_ok/callout=10s,defer_ok,use_sender
        ratelimit = LIM / PERIOD / per_rcpt / user-$acl_m_user
        continue = ${run{SHELL -c "echo $acl_m_user >>DIR/blocked_users; \
           \N{\N echo Subject: user $acl_m_user blocked; echo; echo because \
           has sent mail to more than LIM invalid recipients during PERIOD.; \
           \N}\N | EXIMBINARY WARNTO"}}
        control = freeze/no_tell
        add_header = X-Authenticated-As: $acl_m_user