Koozali.org: home of the SME Server

Procmail Rules not working

Craig

Procmail Rules not working
« on: December 08, 2001, 07:29:09 PM »
I wanted to create email filters as you can in LookOut, so that emails from particular clients where placed into thier own folders under my Inbox in Twiggi.

I have installed Procmail and the User Panel on my SME v5 system. I have then created some folders under my Inbox in Twiggi and then in the User Manager Panel set up a rule that all mail received from a specific email address gets copied into the newly created folder.

The problem is that my emails still end up in my Inbox and not in the folder that I have created.

Any body have any suggestions?

Thanks in advance.

Craig

Darrell May

Re: Procmail Rules not working
« Reply #1 on: December 09, 2001, 06:58:39 AM »
Hi Craig.  You might want to post your .qmail and .procmailrc files so forum members have something to review and comment on ;->

Darrell

Craig

Re: Procmail Rules not working
« Reply #2 on: December 09, 2001, 11:51:59 AM »
Darrell

As follows:

PROCMAIL
# --------------------------------------
# .procmailrc
# by e-smith-procmail; it(@|.)dungog.net
# --------------------------------------

# Default Shell, Program & file locations
SHELL=/bin/bash
DEFAULT=$HOME/Maildir/
FORMAIL=/usr/bin/formail
SENDMAIL=/usr/sbin/sendmail

#some logging
VERBOSE=no
LOGFILE=$HOME/procmail.log

# BEGIN RECIPES

#start of user recipies
# ---------------------

:0
* ^TO_.*mike@edtgeit.com.au
{
   :0 c
   $HOME/Mail/Mike/

   :0
   $HOME/Mail/Mike/
}

# --------------------------
# all else goes to the inbox
:0
$DEFAULT



QMAIL
#------------------------------------------------------------
# DO NOT MODIFY THIS FILE! It is updated automatically by the
# e-smith server and gateway software. Instead, modify the source
# template in the /etc/e-smith/templates directory. For more
# information, see http://www.e-smith.org.
#
# copyright (C) 1999-2001 e-smith, inc.
#------------------------------------------------------------
#stephen@dungog.net for e-smith-procmail
| /usr/bin/procmail ~/.procmailrc
# Vacation Message Disabled


#------------------------------------------------------------
# TEMPLATE END
#------------------------------------------------------------

stephen noble

Re: Procmail Rules not working
« Reply #3 on: December 09, 2001, 02:36:26 PM »
> :0
> * ^TO_.*mike@edtgeit.com.au
> {
>    :0 c
>    $HOME/Mail/Mike/
>
>    :0
>    $HOME/Mail/Mike/
> }

are you sure the address is right, is it in the headers
you should get two copies in your Mike folder

try putting something in the subject and test on that


regards
stephen

Craig

Re: Procmail Rules not working
« Reply #4 on: December 09, 2001, 04:51:44 PM »
Well the rules work great if I tell procmail to move the mail to a folder based on subject.

How do I tell procmail to move mail to a folder under my inbox based upon a email address. ie: all mail from somebody@nowhere.com.au get moved into a folder called somebody in my inbox?

Thanks for your help so far.

Regards
Craig

Darrell May

Re: Procmail Rules not working
« Reply #5 on: December 09, 2001, 06:43:20 PM »
Craig wrote:
> How do I tell procmail to move mail to a folder under my
> inbox based upon a email address. ie: all mail from
> somebody@nowhere.com.au get moved into a folder called
> somebody in my inbox?

Good catch Craig!  Actually currently Stephen's script /etc/e-smith/web/panels/user/cgi-bin/userpanel-procmail uses 'TO_' and does not offer '^From.' logic :-(

It looks like Stephen is following this thread so I'm sure he'll take a look and release an update soon.

Regards,

Darrell

Craig

Re: Procmail Rules not working
« Reply #6 on: December 09, 2001, 07:48:16 PM »
Darrell

Thanks for that.......at least it wasn't all me!

I did wonder if the 'To_' was right....I went and had a look at http://www.ii.com/internet/robots/procmail/qs/ and noticed that 'To_' only covered To, Cc, Resent-To logic as you stated and not From logic which is what is required.

I also noticed on this site there is mention of Sender: Resent-Sender: Delivered-To: I had ago at editing my .procmail.rc file with Sender: but it didn't work as there is no example give and I most likely got the syntax wrong.

Thanks for your help.

Craig

stephen noble

Re: Procmail Rules not working
« Reply #7 on: December 10, 2001, 03:22:04 AM »
>Thanks for that.......at least it wasn't all me!

>I did wonder if the 'To_' was right....I went and had a look at >http://www.ii.com/internet/robots/procmail/qs/ and noticed that 'To_' only covered >To, Cc, Resent-To logic as you stated and not From logic which is what is >required.

hmmm, mutter mutter
my reference man fetchmail*  said it covered all addresses

edit the .procmailrc template for a short term fix

regards
stephen

Darrell May

Re: Procmail Rules not working
« Reply #8 on: December 10, 2001, 04:33:32 AM »
Craig/Stephen.  No worries.

I have a client project I'm working on right now that uses Stephen's e-smith-procmail-0.1-14 contrib.  This gave me the incentive ;-> to dive in and see what I could do.  I have an updated /etc/e-smith/web/functions/userpanel-procmail I will e-mail both of you directly for testing.

Regards,

Michael Doerner

Re: Procmail Rules not working
« Reply #9 on: December 10, 2001, 08:19:38 AM »
Somewhere in the procmail help, mailing list or documentation I found the following macro (?) that I added to my ".procmailrc" and use intensively:

FROM="^(FROM[   ]|(Old-|X-)?(Resent-)?(From|Reply-To|Sender):)(.*\<)?"

(Hopefully that comes through without line break?)

which I use like this:

:0:
* $ ${FROM}.*@techpac\.co
$MAILDIR/vendors/TechPac/

with the meaning: If it comes from an email address where there is "@techpac.co" in it, Then put it into that specific mailfolder.

Is that what you are looking for?

Regards,
Michael

Craig Farrier

Re: Procmail Rules not working
« Reply #10 on: December 10, 2001, 09:07:28 AM »
Darrell

I installed the update you sent me. I then edited my existing rules and chenged the To_ to From and presto it all worked fine.

Will continue to test at let you know the results.

Thanks for your help.

Craig

Darrell May

Re: Procmail Rules not working
« Reply #11 on: December 10, 2001, 10:26:31 AM »
Excellent, thanks for the report back.

Regards,

stephen noble

Re: Procmail Rules not working
« Reply #12 on: December 10, 2001, 03:29:42 PM »
Michael Doerner wrote:
> FROM="^(FROM[]|(Old-|X-)?(Resent-)?(From|Reply-To|Sender):)(.*\<)?"
>
> :0:
> * $ ${FROM}.*@techpac\.co
> $MAILDIR/vendors/TechPac/

thanks michael,

i added an option to select mail from a sender
i'm just using 'from' for now
if i get reports of mail going through i'll look at that macro again

ver .15 is available now from it.dungog.net -> free ->rpms
with this version a single save generates the .procmailrc file

regards
stephen

Craig

Re: Procmail Rules not working
« Reply #13 on: December 10, 2001, 05:13:04 PM »
Stephen

I have downloaded the new version, given it a try and all went well.

Thanks for a great contrib.

Regards
Craig