View Full Version : PROCMAIL and PROCMAILRC locations?

10-07-2004, 08:55 PM

I'm new to WH, and I'm trying to understand how to get PROCMAIL set up. It appears that PROCMAIL is already installed, and I see the file [procmailrc] in my /etc directory, but I'm not sure it's working. I thought you needed to have a [.procmailrc] in your $HOME, and also a [.forward].

Is there WH documentation on how to use these? If not, would some kind soul help me understand how to set these up? I'm trying to implement some mail-driven scripts for my website with various addresses (list-subscribe@domain.com, site-scan@domain.com, etc.).

Thanks for any help you can provide.
-- Steve G. (sarr)

10-08-2004, 11:27 AM
/etc/procmailrc is your "global" Procmail recipe file: what you put in there applies to all incoming mail on your account. This one doesn't start with a .

You don't need a .forward on WestHost - it's all set up for you, you just need to create your .procmailrc in the home directory for the account you want to set up recipes for. For your "root" account, that would be / for all other accounts it would the the home directory you set up for them via your Site Manager (i.e. you have to create them with FTP enabled, give them a home directory, and then disable FTP later if you don't need it - this keeps the home directory).

As for scripting, I would recommend using the Site Manager to create "command" aliases.

10-08-2004, 12:30 PM
Thank you Fayez. Um... is there any way to set up procmail to handle/act as a "catch all"? Do I create a CatchAll account and work with its .procmailrc?

10-08-2004, 12:56 PM

I'm not quite sure what you mean. If you want Procmail to process all mail regardless, then you'd put your recipes in /etc/procmailrc - after turning on the catch all alias in your Site Manager, of course. On the other hand, if you want it to process mail that does not belong to an account or alias, then you could set the catch all to an e-mail/FTP account (with a home directory) called (for example) "catchall" and place the .procmailrc in that directory...

Hope that helps - let me know if it doesn't.

10-08-2004, 01:02 PM
I think that does help. I've set up a catchall account named. By enabling and disabling the AutoReply feature, I see WH add and remove .forward and .autoreplay.sh (in the /etc/virt_users/catchall directory).

I'm not familiar with the .forward syntax being used:
catchall, "|/etc/virt_users/catchall/.autoreplay.sh"
Why the account name at the start?

Hmm... I'm going to play with this a bit more and see if I can get it to make sense.

10-08-2004, 01:07 PM
Cool. Yeah, funny how they spelled it replay. Anyway, you don't need to worry about the .forward at all. Like I said, Procmail recipes will work if placed in the home directory - no messing around with .forward required (or recommended, for that matter.)

10-08-2004, 01:12 PM
Ok... I'm missing something.

I've got a catchall account named catchall.

In /etc/virt_users/catchall I have a file name ".procmailrc" that contains the following:

VERBOSE = "no"
SHELL = "/bin/sh"

* ^To: .*coanon-

I've tried it with and without a .forward file whose contents are:
catchall, "|/bin/procmail"

I see the email arrive in the spool file, but it doesn't appear in the coanon-stuff file. Any ideas what I'm doing wrong?

10-08-2004, 01:16 PM
/etc/virt_users/catchall is NOT the home directory for the catchall account. When you set it up, you should have enabled FTP for the account - which means you had to have given it a home directory (or accepted the default of /ftp/pub/catchall - or whatever the default is). Assuming you used /ftp/pub/catchall this would be where you upload your .procmailrc in ASCII mode (and CHMOD to 644). This is why I say you don't need to mess around with .forward :)

10-08-2004, 01:26 PM
You're a great sport, FZ, and thanks for your help.

I tried that; no joy. I've moved .procmailrc to /ftp/pub/catchall, set permissions to 644, modified it to store in /ftp/pub/catchall/coanon-stuff instead of /etc/virt_users/..., created a coanon-stuff file that's r/w by everyone (perms 666), and sent a test email to coanon-whatever. It still ends up in the spool and not in the file.

I think I'll have to ask WH for help with this (I appreciate your help, but I hate wasting your time).

10-08-2004, 01:29 PM
No problem - and if you were "wasting" my time, I wouldn't be responding.

Short of you sending me your script (so I can test it for you), the other thing you can do is create an alias that is a command and points to that script - this way you don't have to use Procmail. And, if that works then you know it has to do with Procmail and not your script. Feel free to send me your file so I can test it for you (PM me and I'll give you my e-mail address).

10-08-2004, 02:42 PM
I haven't had any luck with placing a .procmailrc in my users home directory either. .procmailrc only seems to work if it's in / for some reason. At which point I think it only works on the default account.

So you either have the default account . . .

or you have the global . . .

I suppose you can play some tricks with INCLUDERC= variable in your /etc/procmailrc, but other than that, I don't see how you can have a seperate one for a created user account.

Has anybody else gotten it to work?

10-08-2004, 04:53 PM

That's really strange. I think you should give WestHost a shout and have them look at that. I don't know how I would be able to live without that functionality... And they should support it because it is supposed to work! They've always worked for me, and I think this is the first time I have heard of it not working for someone... Something definitely isn't right. Are you sure you enabled home directories for the accounts in question (by giving them FTP access) via your Site Manager? If so, did you upload in ASCII and CHMOD 644? Did you try a really simple rule like forwarding a copy of all mail, or storing mail in a mailbox file (just to ensure it is working)? Have you installed SpamAssassin via your Site Manager?

10-09-2004, 12:50 PM
Well, with Fayez's help it's now working. Here's the configuration:

Created a "catchall" user (with FTP, so I have a home directory) as a destination for my CatchAll alias, then created the Catch-All alias and pointed it to the username "catchall".

In /ftp/pub/catchall (the home folder for the user), I created ".procmailrc". This file has the following contents:

SHELL = "/bin/sh"

* ^TO_\<keyword-
| /ftp/pub/catchall/email.php

I had some problems with the script (email.php), but it eventually worked. Most of the problems were related to PHP version. I suggest you run "PHP -l filename.php" to do a lint check (and check for compatibility).

Anyway, my thanks for FZ for his help.
-- Steve G. (sarr)