Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

postfix and pipe to perl script

Status
Not open for further replies.

rig108

Technical User
Jul 27, 2006
5
GB
i have tried two options to pipe t a perl script
and i am looking for a third as the two I thought wil not work

1st option


what i have done is set up postfix to accept mail to 'foo@rep.robin.com'

and deliver them via pipe to the command "repserver -d foo"



its the "deliver them via pipe to the command repserver -d foo"

than i do not know how to set up.?



but my thinking is:



in /etc/aliases someusername: | repserver.pl(path to it)

run newaliases



2nd option

----------------------------------------

echo '"| /path/to/repserver.pl"' >>~/.forward





Why both options will not work:





in the .forward. I must remember the repserver script is able to add new users when they complete the registration process, so I would have to modify the script in order to run one of these two commands after a successful registration. This is messy. I'm quite sure there is a cleaner way to ask postfix to pipe every mails received for ${foo}@${nymdomain} to "repserver.pl -d $foo".?





two commands means i cannot use .forward or /etc/aliases
 
You could use procmail like this:

| repserver.pl $LOGNAME


It might be "cleaner" to just have repserver.pl extract the username from the mail header.
 
Thankyou for your post.

i gave some thought to your suggestion:

use procmail
| repserver.pl $LOGNAME

but i am not sure as in my home dir in .forward
i have:

"|/usr/bin/procmail -f-"

but i may then lose my procmail recipes, i.e., they won't be executed anymore, if i use | repserver.pl $LOGNAME

I was wondering if you knew anything about how I might create a filter in /etc/postfix/master.cf for my script.?
 
before the filter ideaa how about

k. Make rep.robin.net a virtual alias domain, with a wildcard. Point
that virtual alias to some local user (repserver@robin.net or whatever).
Have *that* user deliver to a pipe, via /etc/aliases.


or another way to put it




in some local domain on that server, add an alias for a user, say,
"repserver", that pipes to the program.
Then add rep.robin.net as a virtual alias domain, and add a
wildcard virtual alias that points to repserver@thatlocaldomain.
 
i think the best way is to set up a filter for repserver.pl
any ideas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top