Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do we have to create the log file? In my ~/.procmailrc file, I have said:
LOGFILE=~/.procmail/log
and I have created a directory called .procmail. Does the log file get automatically created? It was not created for me, so I made my own, but I dont understand how data is supposed to input in there. When I try to tail the log file, there is nothing there.
1. Is this the problem with my procmail configuration?
2. Is this what's supposed to happen?
3. How does the logfile get data?
Any help is greatly appreciated.
Thanks in advance.
-Chirag
thanks Dave, I think my problem is the linking between postfix and procmail. Is the only linking that goes on between the two in the main.cf file where it says:
mailbox_command = /usr/bin/procmail -Y -a $DOMAIN DEFAULT=$HOME/Maildir
Is that the only linking? Does this mean that all mail coming through postfix looks for .procmailrc and gets filtered through procmail?
Is there anyway to see if my config is correct?
also, in my postfix main.cf, I have virtual_mailbox_base as /var/spool/mail/virtual and home_mailbox as /var/mail/<username>
Is this right??
All mail that is coming through is getting sent to the virtual mailbox. also, does the MAILDIR HAVE to be $HOME/Maildir or is it /var/mail/<username>
The home_mailbox configuration configuration won't be used, as mailbox_command takes priority.
Unless you're using virtual users (you'll know if you are), the virtual_mailbox_base configuration won't have any effect either.
Basically, once the mail is handed to procmail, postfix considers it delivered and has nothing more to do with it, and procmail does everything from then on.
Yes, I able to see the mail in squirrelmail with no problems. Its just that I dont really know how to change the procmail config so that I can make pipe it through a program before delivery. But first, I need to see how you can pipe the mail to anything, so I played around with the .forward file (which I created) to send all msgs with the subject "test" into a specific folder. But that is now working..
This sends messages (with sizes less that 256K) to spamc (spamassassin). spamc spits the message out to stdout, which procmail takes back in. After going through spamc, any message which comes back with a header 'X-Spam-Status: Yes' then gets put into the zzz-spam directory (I'm using the maildir mailbox format, hence the leading '.', and trailing '/').
There shouldn't be any need for a .forward file to do this.
Did you change the LOGFILE variable in .procmailrc to have $HOME instead of ~ ?
Yes, I would do this as a normal user. root is a special case, and is handled differently...
Code:
# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
# Exception: delivery for root is done as $default_user.
Ok.. i think i figured out how to execute the rc file. I man-ed procmail and found out about the -m command.. So I used procmail -m $HOME/.procmailrc and after, there is a log file and everything!!! But, I used something similar:
:0fw
* < 256000
$HOME/Maildir/new
and tried to send a mail from my gmail account. Shouldnt the mail get sent to $HOME/Maildir/new ?
Ok, still no luck it seems that everytime i change something on the rc file, I have to execute procmail -m $HOME/.procmailrc for the changes to take place. And it give me the following input in my log file:
procmail: Assigning "INCLUDERC=/home/<user>/.procmail/rc.testing"
procmail: No match on "^Subject:.*test"
procmail: Skipped "* ^From: <myaddress>@gmail.com"
procmail: Skipped "IN"
procmail: Skipped ".testing"
procmail: Assigning "INCLUDERC=/home/<user>/.procmail/rc.maillists"
procmail: Couldn't read "/home/<user>/.procmail/rc.maillists"
procmail: No match on "^Subject:.*test"
procmail: Match on "< 256000"
procmail: Locking "/home/<user>/Maildir/new.lock"
procmail: Assigning "LASTFOLDER=/home/<user>/Maildir/new/msg.ql4c"
procmail: Opening "/home/<user>/Maildir/new/msg.ql4c"
procmail: Acquiring kernel-lock
procmail: Unlocking "/home/<user>/Maildir/new.lock"
Folder: /home/<user>/Maildir/new/msg.ql4c
What is happening??
When i read the msg.ql4c file, its empty
If you're using maildir as a mail box format (which I assume you are, if you have specified a directory for mail to be delivered to rather than an mbox file), then the directory path should have a trailing / . The 'new', 'cur' and 'tmp' directories in maildir are part of the standard, so you don't need to specify them.
So, if using maildir:
Code:
#Set on when debugging
VERBOSE=on
MAILDIR=$HOME/Maildir/
#directory for storing procmail log and rc files.
PMDIR=$HOME/.procmail
LOGFILE=$HOME/.procmail/log
INCLUDERC=$HOME/.procmail/rc.testing
INCLUDERC=$HOME/.procmail/rc.maillists
:0:
* ^Subject:.*test
$HOME/Maildir/IN.testing/
:0:
$HOME/Maildir/
If you're using standard Unix mbox mailboxes, then specify the filename of the mbox you want the messages to be dumped into.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.