Link to home
Start Free TrialLog in
Avatar of internetcreations
internetcreations

asked on

Passing variables to procmail from Qmail

I am calling procmail from a .qmail-default file with the following command:

 |/var/qmail/bin/preline /usr/local/bin/procmail -f /usr/home/username/.procmailrc

I am testing several scripts that were from a different server that I do not have access to.  The .procmailrc file references a variable passed to it ($1), but qmail isn't passing it anything.  

I would like to have qmail pass along the local-part of the email address to Procmail so that I do not have to rework the script.  I suspect this is something that is fairly simple, but I do not know how to do.
Avatar of arnold
arnold
Flag of United States of America image

$1 is the first argument in your example anything you place after the existing line will be included in $1.

i.e. |/var/qmail/bin/preline /usr/local/bin/procmail -f /usr/home/username/.procmailrc this_is_the_first_argument

$1 in the processing of .procmailrc will have this_is_the_first_argument.

Usually you want to maintain a system wide procmailrc in /etc/ which requires that procmail be set with the SUID bit.

You also have to make sure to drop privileges prior to trying the local delivery/finale delivery to the mailbox.

Work your way back what tests use the $1 parameter?
Post the .procmailrc as it may make things clearer.
Avatar of internetcreations
internetcreations

ASKER

I want to have the this_is_the_first_argument be the local part of the email address to which the message was sent.  Are you aware of any way to do this?
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial