Solved

Passing variables to procmail from Qmail

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

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php mail headers 2 39
Best way to virtualise a remote Linux server 2 49
installing LSI MegaRAID Storage Manager on CentOS 7 22 51
Problem with Yahoo and Outlook SMTP Email 7 63
Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

948 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

22 Experts available now in Live!

Get 1:1 Help Now