The ! action forwards to all the specified mail addresses.
But that is precisely what I want to do i.e. forward the email to the
address returned by myscript.
I'm not sure what you mean by not being able to start an action in a recipe
without piping the message to it. For example I am able to run the following
without any problems:
USERNAME=rav
:0
* ^Subject:.*test
! `myscript "$USERNAME"`
If only I could get USERNAME to contain the actual value of the person in
the TO field (or RECEIVED for) instead of hardcoding it as above.
-----Original Message-----
From: Lee Howard [mailto:faxguy(_at_)server(_dot_)deanox(_dot_)com]
Sent: Tuesday, May 16, 2000 2:23 AM
To: Rav Ahuja
Subject: RE: extracting the TO username
The ! action forwards to all the specified mail addresses. check man
procmailrc
I would *love* to be able to start an action in a recipe *without* piping
the message to it (because I could use it often, and it would save me the
hassle I'm about to explain), but I don't think it's possible. procmail is
designed to be a mail filter, more than anything, which makes the piping
essential. the whole usage of procmail to execute scripts and do things
beyond the scope of a filter is really not its design... however, it works.
If you need to eliminate the message sent to stdout by procmail because
myscript will interpret it, you need to create some type of script (sh?),
myscript2, to initiate myscript and ignoring the stdin. Call myscript2
from procmail, it ignores stdin and calls myscript without any stdout.
If that makes sense.
Lee Howard
At 02:05 AM 5/16/00 -0400, you wrote:
Since I don't want to pipe the message to the program I tried the following
instead but it didn't work:
:0
* ^TO_\/
! `myscript "$MATCH"`
I also saw some related hints in the mailing list archive and tried the
following, which also did not work:
:0
* ^To:[ ]*\/[^ ].*
! `myscript "$MATCH"`
Any other suggestions?
Thanks,
_Rav.
-----Original Message-----
From: Lee Howard [mailto:faxguy(_at_)server(_dot_)deanox(_dot_)com]
Sent: Tuesday, May 16, 2000 1:19 AM
To: rsahuja(_at_)julian(_dot_)uwo(_dot_)ca
Subject: Re: extracting the TO username
Try
:0
* ^TO_\/
| myscript "$MATCH"
Lee Howard
(of course, I haven't tried this. I'm just reading a suggestion from page
14 of man procmailrc and associating it with the MATCH definition on page
9.)
At 03:49 AM 5/15/00 -0400, you wrote:
I am trying to write a recipe that gets the USERNAME from the "To" field
(or
Received for) of the incoming message, passes it to a program which
accesses
a database and returns an address to procmail to forward the email.
That is, if the incoming email is meant for abc(_at_)mydomain(_dot_)com I
want the
recipe to be able to extract "abc" (what I referred to as USERNAME ealier)
and pass it as a parameter to the program. My program then returns
xyz(_at_)somedomain(_dot_)com(_dot_)
So something like this should do the trick:
:0
! `myscript "$USERNAME"`
But I can't figure out how to extract the $USERNAME before passing it to
the
database program. Any hints on how to do this would be greatly
appreciated.
BTW, I realize that ideally I should be using the MTA to do this, but we
use
vitual domain hosting and don't have access to sendmail's
virtualusertable,
etc.
Thanks,
_Rav.
________________________________________________________
1stUp.com - Free the Web
Get your free Internet access at http://www.1stUp.com