Redirecting email to a Script

Jim Holland mailscanner at MANGO.ZW
Thu May 12 20:29:49 IST 2005


Hi David

On Thu, 12 May 2005, David C.M. Weber wrote:

> Brief overview:
>         Mailscanner system in front of an exchange server.  I'm trying
> to get email to activate a script via an alias when an email comes in.
>
> Right now I've got /etc/aliases set up w/:
>
> somebody:          "| /post_leads"
>
> Then I did a newaliases.

This means you are trying to run the script post_leads which is in your
root directory - I don't think that is what you intend!

> I have a symbolic link in /etc/smrsh pointing to the real script.
> Here's a ls -lah
>
> [root at computername smrsh]# ls -lah
> total 12K
> drwxr-xr-x   3 root root 4.0K May 12 13:36 .
> drwxr-xr-x  57 root root 4.0K May 12 13:42 ..
> lrwxrwxrwx   1 root root   35 May 12 13:36 post_leads ->
> /nobody_scripts/post_leads

Then try the following in your aliases file:

        somebody:          "| /etc/smrsh/post_leads"

and put the script there with permissions 755.  I am not sure what is
required if it is a link to somewhere else - the link must be 755, but
possibly the target also has to be 755.

> And finally, here's the script:
> #/bin/bash
> echo $1 >> out.txt

This is definitely not what you want!  Try:

        tee -a out.txt

Regards

Jim Holland
System Administrator
MANGO - Zimbabwe's non-profit e-mail service

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!




More information about the MailScanner mailing list