View Full Version : Using .procmailrc for all accounts associated with domain

03-26-2004, 06:54 PM
1.) After months of fooling around with my .procmailrc file in my $HOME directory and having no luck, I finally figured out that the .procmailrc file that the procmail program is actually reads from is in the '/' directory. Why I even have access to '/' I don't know. Iimagine logging in once a week and having to manually delete 1000+ e-mails from an internet cafe in Istanbul, very frusturating when you're travelling and don't have the luxury of a local e-mail client with spam blocking ability.

2.) My issue now that I found the correct .procmailrc file is that it only works for my default (catchall account). Anybody out there have an idea how to right a .procmailrc file that will apply globally to all e-mail accounts associated with a domain? I can't find anything in the online documentation.

Thanks a million in advance to whoever replies,

03-26-2004, 07:26 PM
You might want to checkout Jalal's page. It has two sections on working with email on WH and explains some things you can do with procmail. Also tells where the files are located for your other users.


I think that well get you started. Let us know if you have other questions.

03-27-2004, 02:53 AM
Jalal summed up the procmail elegently as I knew he or FZ would and I was doing another high wire act and then I saw his post and thought I'd better scratch what I wrote, but I can't. I'm committed. A penalty of editing your original post. Arrrg! :x

03-27-2004, 03:02 AM
There is a file /etc/procmailrc, that applies to all accounts on the VPS, it is site wide.
For the 'super-user' (the site owner) their home directory is either / or /home/mydomain/, in the case of procmail it is /.procmailrc
For other email accounts that you set up, they have their home directories in /ftp/pub/myuser and you can install their .procmailrc files in there if needed.


03-28-2004, 11:24 PM
Thanks Jalal,

the rules I write into the /etc/procmailrc file aren't working though. Adding a .procmailrc file into the /ftp/pub/user dir does work.

03-28-2004, 11:40 PM
to be specific these two rules don't work in /etc/procmail

* ^X-Spam-Status: Yes

* ^X-Spam-Flag: YES

but others do

I know nothing is wrong with the rule syntax because they work in .procmailrc files in / and /ftp/pub/userdirs. I tried creating a .procmailrc in the /etc dir and it still didn't work

03-29-2004, 12:53 AM
nevermind the rules did work i had comments at the end of the line

i.e.- code #coment

and that was screwing things up

03-29-2004, 03:31 AM
Anyone ever considered writing the .procmailrc file on the fly and if so are aware of any problems? It seems doable. When I was setting up my pictures capability my changes took pretty quick.


WestHost - MMellor
03-29-2004, 08:36 AM
Hello Bnicolas,

Do you have any past tickets or anything that you would like me to take a look at as far as support goes? If you feel that anything is lacking on our support end please let me know and I'll take a look into it right away.

03-29-2004, 10:16 AM

I'm not quite sure what you mean? I don't see any problem in writing to it, as long as you "do it properly" and use (for example) file locking, etc. But maybe there is a better way to do what you want to do...?

03-29-2004, 02:01 PM
Would file locking even be necessary? Until the file is closed no other process in the system could get its mits on it. I'm a firm believer in file locking, but I question how valueable it is when you're the only one writing and everyone else reads. My use of it leans more toward the "after the fact". Fact my main program own the mailbox. If I were to enhance any functionality I'd have to change it. Or I could modify .procmailrc to treat certain e-mails differently. Unless these changes were static I'd have to unmodify procmailrc myself and since I'm shooting for 100% automation - there is no better way.


03-29-2004, 02:57 PM
I just chose file locking out of the blue as an example consideration. I'm not up to speed on such detailed technical aspects ;) Personally, I try to err on the side of caution. Seeing as the .procmailrc file is accessed so frequently (every incoming mail), it is possible that it might be accessed while you are writing to it and problems could arise (again, I'm just thinking theoretically, not sure if this would really be a concern in the "real world"). Apart from that, what if the program that is writing to it runs "simultaneous copies" of itself?

Unfortunately, I still fail to understand what it is you want to automate (I must be in a stupid mood). Could you perhaps give me an example? And, don't get me wrong, I'm not trying to stop you - by all means go ahead and experiment (that's where all the fun is)! I'm just offering feedback based on my (obviously very limited) knowledge (only in this case ;))...

03-29-2004, 03:24 PM
what if the program that is writing to it runs "simultaneous copies" of itself?

Hmmm. I didn't think of that one and thanks for pointing it out. I already know how to fix it. Next :)

I'm just playing with ideas right now. And no FZ just because this isn't your area I still look forward to sucking your brain dry, because you are up on lots of topics I'm not.


03-29-2004, 05:54 PM
Hehe, cool :D

04-01-2004, 01:42 AM
Ok here's an example. My web-site runs on a set schedule (cron). It's a personals site and e-mail is used for everything. When a user sends a message it could take upto 4 hours before the person they sent it to got it. Just suppose I wanted to allow some users to send messages instaneously. Exactly who these users are varies, because maybe they pay for the priviledge. I want these changes to occur under software control. My manual changes to the .procmailrc file took pretty rapidly so I don't see writing to it under software control a problem. Now exactly how I pull the rest off is another story, but one thing is for sure if my program which is launched as result of the matching e-mail returns an error nothing happens and it winds up in the catch all where I want it to. So the idea is to have the program watch the /var/mail/spool file and when it changes run the web-site. In essence be no different than if I signed on with SSH and ran it manually. This is just a rough out-line and kind of whacky.