Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing variables to procmail from Qmail

Posted on 2010-09-07
3
Medium Priority
?
503 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 80

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 80

Accepted Solution

by:
arnold earned 2000 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

782 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