Solved

Passing variables to procmail from Qmail

Posted on 2010-09-07
3
482 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 76

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 76

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In this video we show how to create a mailbox database 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 >> Data…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now