[Mimedefang] calling system command

kd6lvw at yahoo.com kd6lvw at yahoo.com
Sat Jan 8 19:55:47 EST 2011


--- On Sat, 1/8/11, David F. Skoll <dfs at roaringpenguin.com> wrote:
> pete <pete at nevill.uk.net> wrote:
> 
> > I would like to call a system command when a specific subject string
> > is passed.
> 
> > if ($Subject =~ /\run ls\b/i) {
> >     system("/bin/ls");
> >     }
> 
> > This works the first time when I send a mail with "run ls" in the
> > subject line but causes mimedefang to crash.
> 
> The problem is that your filter *must not* print anything ...

Definently not good.  Look into sending the mail to a program instead (cf. sendmail's aliases database - entries starting with "|").

If using the aliases database, you may want to end the command with an "||exit 0" just in case it fails - so a DSN isn't sent back to the sender (unless you want errors to be reported).  There are some cases (e.g. spamtraps feeding "|spamassassin -k") that shouldn't DNS back on errors.



More information about the MIMEDefang mailing list