Solved

Passing variables to procmail from Qmail

Posted on 2010-09-07
3
490 Views
Last Modified: 2013-12-02
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.
0
Comment
Question by:internetcreations
  • 2
3 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 33622346
$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.
0
 
LVL 1

Author Comment

by:internetcreations
ID: 33626603
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?
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 33633044
This is passed and set by the mail server.
$LOGIN or $USERNAME has this information.  QMAIL has other variables that it passes to procmail.
It all depends on your qmail setup.
$USER, etc.

http://www.qmail.org/man/man8/qmail-command.html
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Easy CSR creation in Exchange 2007,2010 and 2013
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question