| Archived Post |
|
|
|
| Written by Bill Olson |
| Sunday, 12 April 2009 02:28 |
|
I found this post on the internet and saved it here. March 14, 2003 qmail. vpopmail. procmail.How comes they just don't want to work together? Anyone seen this problem before? Posted by imajes at March 14, 2003 09:36 AM | TrackBack Comments |
| Last Updated on Saturday, 30 May 2009 16:07 |
I just finished working on exactly this problem. It took me more than 12 hours to solve it. Non of what Google came up with worked for me.
This is my procmailrc file
###### Procmairc start ##########
#
# Uncomment these if you want to debug
#VERBOSE=ON
#LOGFILE=/tmp/procmail.log
# Find the users home directory and store in variable
VIRTUALHOME=`/var/vpopmail/bin/vuserinfo -d $EXT@$HOST`
# Location of safecat
SAFECAT=/usr/local/bin/safecat
# Location of the users Maildir
MAILDIR=$VIRTUALHOME/Maildir
# Give each user a spamfolder where spam-tagged mail will be delivered.
SPAMDIR=$VIRTUALHOME/Maildir/.Spam
# Check if the user have a spamfolder, if not, create one.
# We never use this variable, but the command will be executed, dirty dirty.
CHECKSPAMFOLDER=`if [ ! -d $SPAMDIR ]; then /var/courier-imap/bin/maildirmake $SPAMDIR && chown -R vpopmail:vchkpw $SPAMDIR && echo "INBOX.Spam >> $MAILDIR/courieimapsubscribed"; fi`
# Finally we can let SpamAssassin check our mail.
:0fw
| /usr/bin/spamassassin
# If the message is tagged as spam, put it in spamfolder
:0w
* ^X-Spam-Status: Yes
| $SAFECAT $MAILDIR/tmp $SPAMDIR/new
# If the message is considered clean, deliver as normal.
:0w
| $SAFECAT $MAILDIR/tmp $MAILDIR/new
###### Procmairc end ##########
NOTE: The CHECKSPAMFOLDER is only for squirrelmail.
In .qmail-default iI have this:
| preline /usr/bin/procmail -p -m /path/to/procmailrc
Good luck
12:30 AM on November 2, 2003 · comment by This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view i
Great Help! This file was exactly what I have spent ages looking for!
Have you had problems with the qmail message que getting quite long? Just wondering ....
10:10 AM on November 18, 2003 · comment by Adrian Robertson
Hi, we have been using the script you suggested and it works well. Although how do you catch email accounts that do not exist? Any help would be great!
11:19 AM on November 20, 2003 · comment by This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
On my server, where vpopmail uses MySQL and so on, the solution presented on the first comment fails on alias users, for example if the user has an account 'firstnameX', the vuserinfo fails to find user as ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it ', which is kinda groody.
(The solution would've been quite what i've been searching for otherwise.)
Another thing I haven't quite figured out yet are the .qmail-user -files, procmail gets run only if it's in domain's .qmail-default , and .qmail-username -files never seem to get processed. If anyone would've thoughts on these issues, I'd be pleasantly surprised to get back an email covering them.
cheers.
10:35 AM on February 2, 2004 · comment by This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
as Adrian commented on catching email accounts that doesnt exist, I tried putting
:0w
|/var/vpopmail/bin/vdelivermail '' bounce-no-mailbox
but it didn't work, mail kept getting requeued.
my temporary solution was to put
:0
*
/var/vpopmail/domains/dom/postmaster/Maildir/noaccount/
at the end of procmailrc.
05:10 AM on February 13, 2004 · comment by This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
To solve the "non-existent" user problem, I just create a symbolically linked .qmail-username file for each user to a file called .qmail-template. The .qmail-template file contains what the author listed above. My .qmail-default file then looks like
"| /var/vpopmail/bin/vdelivermail '' delete" to delete the messages
or you can use
"| /var/vpopmail/bin/vdelivermail '' bounce-no-mailbox" to bounce the message
With the .qmail-default set to one of these I do not have to worry about any non-existent user. Yes it adds one more step after creating a virtual user, but it solves the issue and everything behave like I would want it to.
02:44 PM on April 5, 2004 · comment by This e-mail address is being protected from spambots. You need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
Great stuff. Here is another solution to the problem, which uses maildrop instead of procmail for the mail delivery:
http://wotsit.thingy.com/haj/mailfilter-spamassassin-vpopmail.shtml
Works well in some quick tests, and has no problem with non-existant mailboxes.
Lawrence
lawrence (at) aslak (dot) net