When I had my issue this is how I debugged it and the notes I made to 'self' - they may help you.
First thing to note, if mail is trying to be delivered to the wrong place, either your .procmailrc file is missing (not in the right place - /home/user/.procmailrc), not named correctly (missing . at the start), has incorrect directives that stop it doing what you want or is not being read for some reason.
The first thing I would do is backup your current .procmailrc and create a fresh test version containing the correct directives for your system.
First make a note of your shell:
Code:
which sh
{OUTPUT SOMETHING LIKE}
/bin/sh
Next we want the system default mail directory. I've noticed myself that some systems have the mail directory listed in the environment variable '$MAILDIR', others don't have that variable but instead have '$MAIL'. Using the wrong one in .procmailrc will fail. You can find it like this:
Code:
printenv MAIL
{OUTPUT LIKE}
/var/mail/root
BUT THIS ONE - ON MY SYSTEM - DOES NOT EXISTS
printenv MAILDIR
{nothing}
Next, for ease and testing, say we want to redirect all mail to /home/user/newmailbox. We need to make sure that directory exists or it will fail:
Code:
mkdir /home/user/newmailbox
With this information and the directory in place to take our mail, create a fresh .procmailrc file with debbuging enabled:
Code:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILDIR=/var/mail #we got this from printenv MAIL (and could use $MAIL)
VERBOSE=ON #turn on debug info
#simple redirect all
:0
/home/user/newmailbox
Rather than wait for mail to come in, create a simple text file test message called 'message.test'....
Code:
Return-Path: <test@procmail.local>
X-Original-To: user1
Delivered-To: user1
Received: from random.local (random.local
[123.123.123.123]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256
bits)) by bogus.local.test; Fri, 26 Feb 2010
22:09:33 +0000 (GMT)
Date: Fri, 26 Feb 2010 17:10:03 -0500
To: user1
Subject: Reply to thread 'running procmail on rented server space'
From: "testprocmail.local" <test@procmail.local>
Auto-Submitted: auto-generated
Message-ID: <12345@12345>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Dear user,
This is a test
The cat or less it through procmail for 'user' and see what happens:
Code:
less message.test | /usr/bin/procmail -d user
*assuming your procmail is in /usr/bin/procmail - find it with 'which procmail' if not.
The debug info should help if things go wrong, but you will hopefully see something like 'You have new mail...' pop up on the cli. Check the contents of /home/user/newmailbox looking for the test message:
Code:
-rw------- 1 user user 6.1K 2010-02-27 09:27 msg.6AcE
I hope that helps, or gets you closer to a fix.