LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   running procmail on rented server space (https://www.linuxquestions.org/questions/linux-newbie-8/running-procmail-on-rented-server-space-791803/)

evaristegalois 02-26-2010 03:32 PM

running procmail on rented server space
 
I am trying to set up mutt with fetchmail and procmail on server space that's not mine. I have access to /home/myusername but not to /var/spool/myusername. Everything seems to work well, but I
have no idea where fetchmail (or procmail) is dropping off my mail. If
I use this .fetchmailrc file:

Quote:

poll mysite.com
with protocol pop3
username myusername password mypassword
and smtpname me@mysite.com
;
then fetchmail doesn't complain at all but I can't find the mbox that
my mail's been downloaded to. If I use this .fetchmailrc file:

Quote:

poll mysite.com
with protocol pop3
username myusername password mypassword
and smtpname me@mysite.com and mda "/usr/bin/procmail -d %T"
;
fetchmail complains:

Quote:

.procmail: Couldn't create "/var/spool/mail/myusername"
having lines such as these in my .procmailrc file didn't help at all:

Quote:

ORGMAIL=$HOME/tempmaildir/spool
MAILDIR=$HOME/tempmaildir
DEFAULT=$HOME/tempmaildir/spool
:0:
~/tempmaildir/spool/mbox

spampig 02-26-2010 03:42 PM

As far as the black-holing of mail, have a look at the output of the 'env' command and look for: MAIL=/
Caveat, look for any .forward files in the home directory that are forwarding your mail 'elsewhere'. You may not be able to change the path as you want, but you should be able to find where it's going with that.

I've had a similar issue today myself with 'vanishing' mail. For a moment it reminded me of Exchange...... chuckle...

evaristegalois 02-26-2010 05:10 PM

It doesn't help. I've tried to change MAIL to /home/myusername/mail, but procmail still tries to create /var/spool/mail/myusername, but it doesn't have permission to do so (I am not the superuser). env reads MAIL correctly as /home/myusername/mail, but the complaint

Quote:

.procmail: Couldn't create "/var/spool/mail/myusername"
persists, and my mail is nowhere to be found. No .forward files.

spampig 02-27-2010 05:04 AM

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.


All times are GMT -5. The time now is 10:26 PM.