LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-18-2007, 10:50 AM   #1
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Rep: Reputation: 15
procmail- log file


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
 
Old 05-18-2007, 11:28 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

Try using:

LOGFILE=$HOME/.procmail/log

Maybe the ~ isn't being expanded.

Dave
 
Old 05-18-2007, 11:59 AM   #3
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
confused..

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>

Soo many questions ... Soo confused.. please help
 
Old 05-18-2007, 12:10 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi again.

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.

Is mail being delivered OK?

Dave
 
Old 05-18-2007, 12:55 PM   #5
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
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..
 
Old 05-18-2007, 12:58 PM   #6
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
And I cannot figure out the errors because there is no log file..
 
Old 05-18-2007, 01:05 PM   #7
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
OK, here's a bit of my .procmailrc:
Code:
:0fw
* < 256000
| /usr/bin/spamc

:0:
* ^X-Spam-Status: Yes
.zzz-spam/
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 ~ ?

Dave

Last edited by ilikejam; 05-18-2007 at 01:06 PM.
 
Old 05-18-2007, 01:12 PM   #8
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks Dave.. yes, I changed the LOGFILE address to $HOME/.procmail/log

Also, Ive been doing this all as a super user (root), should I do this in my user account?
 
Old 05-18-2007, 01:18 PM   #9
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
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.
 
Old 05-18-2007, 01:40 PM   #10
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
one step closer

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 ?
 
Old 05-18-2007, 01:44 PM   #11
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
No.

The :0fw directive will try to *execute* $HOME/Maildir/new .

You want:
Code:
:0:
$HOME/Maildir/new
That will send every message to $HOME/Maildir/new .

Dave
 
Old 05-18-2007, 01:52 PM   #12
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
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
 
Old 05-18-2007, 01:55 PM   #13
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Could you post your .procmailrc ?
 
Old 05-18-2007, 02:01 PM   #14
Chiragrs
Member
 
Registered: May 2007
Distribution: Kubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ilikejam
Could you post your .procmailrc ?
Here it is:

[HTML]#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:
* < 256000
$HOME/Maildir/new
[/HTML]
 
Old 05-18-2007, 02:17 PM   #15
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
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.

Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Procmail : Cat from External File joseph Programming 3 12-11-2006 07:37 AM
procmail config file overwritten?? lmcilwain Linux - Software 2 09-21-2006 08:56 AM
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
.forwards file with procmail problem kzar Linux - General 1 06-09-2004 11:17 AM
Procmail and file permissions J_Szucs Linux - Newbie 0 08-15-2002 02:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration