Re: how to trigger an action on email recieved



On Dec 7, 6:44 pm, Kees Theunissen <theun...@xxxxxxxx> wrote:
Robert M. Riches Jr. wrote:

On 2007-12-07, rpna...@xxxxxxxxx <rpna...@xxxxxxxxx> wrote:
Quick question:Is there any recipie I can impliment as a user.
Without invoking my root previlages. Second, my MTA seems to be
sendmail.(I think; any way to check?) So would the procmail recipies
above still work?

Procmail, used as a mail delivery agent, will run with the access
rights of the user receiving the message, and will use that users'
~/.procmailrc file.
See the manpages (procmail, procmailrc and procmailex) for further
details.



Depending on your MTA, you may be able to put an instruction
to pipe through procmail in your ~/.forward file.

All linux distributions I've seen so far (slackware, redhat,
fedora, debian) use procmail as the default local delivery agent
for sendmail.

To find your MTA, you might use your package manager to see
which of sendmail and/or postfix is installed.

This will depend on your package management system. I don't know
if Redhat would prevent the installation of several MTA's.
Dependency rules on a Debian system would prevent this. But in
theory there is nothing wrong if you install several MTA's
and 'activate' one of those by setting up some symlinks.
Such symlinks will be used anyway because sendmail has been
the de facto standard for a long time. Other MTA's will use
symlinks to alias themselves as 'sendmail' in order to supply
an uniform interface to the users of the system.

Follow those symlinks and just see what program they point to.
On my Slackware 12.0 system, with sendmail 8.14.1 installed
this shows:
kees@lankhmar:~$ ls -l `which sendmail`
lrwxrwxrwx 1 root root 18 2007-10-31 18:29 /usr/bin/sendmail ->
/usr/sbin/sendmail*
kees@lankhmar:~$ ls -l /usr/sbin/sendmail
-r-xr-sr-x 1 root smmsp 692804 2007-06-10 07:16 /usr/sbin/sendmail*

An easy test is to send a message to yourself on your workstation and
inspect the headers of the received message. Something like:
date | sendmail kees@localhost
This resulted in the following message:

From k...@xxxxxxxxxxxxxxxxxxxx Sat Dec 8 01:07:56 2007
Return-Path: <k...@xxxxxxxxxxxxxxxxxxxx>
X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08)
on lankhmar.remmin.home
X-Spam-Level:
X-Spam-Status: No, score=-0.1 required=5.0
tests=ALL_TRUSTED,AWL,BAYES_00,
MISSING_HEADERS,MISSING_SUBJECT autolearn=no version=3.2.3
Received: from lankhmar.remmin.home (IDENT:1000@localhost [127.0.0.1])
by lankhmar.remmin.home (8.14.1/8.14.1)
with ESMTP id lB807usY024821
for <k...@xxxxxxxxxxxxxxxxxxxx>; Sat, 8 Dec 2007 01:07:56 +0100
Received: (from kees@localhost)
by lankhmar.remmin.home (8.14.1/8.14.1/Submit) id lB807uPP024820
for kees@localhost; Sat, 8 Dec 2007 01:07:56 +0100
Date: Sat, 8 Dec 2007 01:07:56 +0100
From: Kees Theunissen <k...@xxxxxxxxxxxxxxxxxxxx>
Message-Id: <200712080007.lB807uPP024...@xxxxxxxxxxxxxxxxxxxx>

Sat Dec 8 01:07:56 CET 2007

Sendmail shows its version number and config file version (both 8.14.1
in this case) in the 'Received:' headers. Although the name 'sendmail'
is not mentioned in the headers, this version number is a sure
indication that the real sendmail is involved.
Other MTA's (and other sendmail configurations) might show their name
in the 'Received:' header(s) added by them.

Regards,

Kees.

--
Kees Theunissen.

I did as suggested :
ls -al `which sendmail` => /usr/sbin/sendmail -> /etc/alternatives/mta
=> /usr/sbin/sendmail.sendmail.

So it seems we are using sendmail on the system! Thanks for the tips
Kees and Robert.

Next: I added these lines to ~/.procmailrc

:0
*
| /home/rpnabar/bin/a.sh


Now, I thought whenever I received an email procmail should run a.sh.
Am I correct in thinking so? Unfortunately there seems to be no action
taken.

Aain, I get very little regular email on this user linux account. So
I'm thinking of putting a keyword in the subject or body of the
message and using its presence to trigger a.sh. But thats for later.
Right now I just want the script to run!

Any ideas what I'm messing up? Again, I can't change any root files so
its important that I do this through user ode changes and scripting.

Thanks!
.



Relevant Pages

  • Re: how to trigger an action on email recieved
    ... See the manpages (procmail, ... which of sendmail and/or postfix is installed. ... if Redhat would prevent the installation of several MTA's. ... Such symlinks will be used anyway because sendmail has been ...
    (comp.os.linux.misc)
  • Re: Problem with Skunkware procmail 3.1.5 & 5.0.7 MP5
    ... for programs you want to allow sendmail to run. ... It appears to be in configured format followed by the old format. ... And I still need suggestions on how to prevent procmail from hosing my ... the next thing to do is get Spamassassin 3.1.4 to work. ...
    (comp.unix.sco.misc)
  • Re: need help about sendmail
    ... Copying all mail to Archive *The following is probably made obsolete by ... sendmail to archive copies of outgoing mail". ... The Sendmail FAQ does offer three suggestions for doing this, ... In the FAQ, and in the newsgroup, it is also suggested that Procmail can ...
    (RedHat)
  • Re: need help about sendmail
    ... One of the most common questions on comp.mail.sendmail is "How do I get ... sendmail to archive copies of outgoing mail". ... In the FAQ, and in the newsgroup, it is also suggested that Procmail can do ...
    (RedHat)
  • Re: Sendmail relay and procmail
    ... all mails i piped to procmail on the way to the recipent. ... Im on openbsd4.1beta running sendmail 8.14.0 ... Now its time for procmail. ... it fails, then it tries to send a bounce and it fails too, then it tries ...
    (comp.mail.sendmail)