You are not logged in.

#1 2007-10-23 02:59:11

F
Member
Registered: 2006-10-09
Posts: 322

procmail issues

Hi guys, I'm having some trouble configuring procmail. If anybody can help me out i'd be infinitely grateful. All I want is for email from the [arch] mailing list to go to a separate 'arch' mailbox (not necessarily a separate directory but I don't really care) and for email from the [dwm] mailing list to go to a separate 'dwm' mailbox. All other mail I want to be shown/seen/sent-to the 'inbox' mailbox. Thats it. For some reason I am unable to do this even though i've scoured the man pages and online documentation. I've even looked at other mutt/procmail threads on this board. :\

The following are my configs for .muttrc and .procmailrc. If there's any other information you need I'd be happy to share.

[f|~]% cat .muttrc 
set record="~/mail/sent"

#mailboxes /var/spool/mail/f      # my mailboxes filtered by procmail
#mailboxes /home/f/mail/arch
#mailboxes /home/f/mail/pacman-dev
#mailboxes /home/f/mail/tur-users
#mailboxes /home/f/mail/bugtraq

set folder="~/mail"
mailboxes =~/mail/inbox
mailboxes =~/mail/arch
mailboxes =~/mail/dwm

save-hook .* =inbox
subscribe arch dwm

#run fetchmail by hitting key of G
macro index G "!fetchmail -a -m 'procmail -d %T'\r"
macro pager G "!fetchmail -a -m 'procmail -d %T'\r"



# when postponing messages, ask where to save them
set postpone=ask-yes

# default file to save postponed messages
set postponed="~/mail/postponed"

# ask if I want to recall postponed messages when I start a new message
set recall=ask-yes


# My email address
set pop_user="********@*******.com"
#
# # My email account password
set pop_pass="******"

set pop_host="pops://******:******@pop.******.com:995"
set pop_last
unset pop_delete

#mail send options
set sendmail="/usr/bin/esmtp -v -X /tmp/esmtp.log"
#
# # Too many email headers make reading a message difficult
ignore *
unignore From: To: Cc: Subject: Date: #Only these are shown in the header
#
# #To ensure that mutt does not put
# #'username@localhost.localdomain in From
set from="lone.nomad@gmail.com"
set use_from=yes
set envelope_from=yes
#
# #The text editor I want to use to write emails
# #The default is nano
set editor="vi"

# for threaded view
set sort=threads

#check for new mail on startup
exec fetch-mail

# set up the sidebar, default not visible
set sidebar_width=12
set sidebar_visible=yes

# which mailboxes to list in the sidebar
#mailboxes =inbox =arch =bugtraq

# color of folders with new mail
color sidebar_new yellow default

# ctrl-n, ctrl-p to select next, prev folder
# # ctrl-o to open selected folder
 bind index \CP sidebar-prev
 bind index \CN sidebar-next
 bind index \CO sidebar-open
 bind pager \CP sidebar-prev
 bind pager \CN sidebar-next
 bind pager \CO sidebar-open

bind generic    <left>            previous-entry
bind generic    <right>        next-entry
[f|~]% cat .procmailrc
MAILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
LOGABSTRACT=no
#VERBOSE=on   used only for debugging
VERBOSE=off
FORMAIL=/usr/bin/formail
NL="
"

##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition !
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into egrep
##one action line follows the conditions, in this case it is a mailbox name

#catch duplicates using formail
:0 Whc: .msgid.lock
| $FORMAIL -D 16384 .msgid.cache

:0 a
$MAILDIR/duplicates

#no more html messages
:0
* ^Content-Type:.*html
$MAILDIR/junk

#now put my mail lists into mailboxes
:0
* ^From:.*arch@archlinux\.org
$MAILDIR/arch/

:0
* ^From:.*dwm@suckless\.org
$MAILDIR/dwm/

:0
$MAILDIR/inbox/


################################
# Last rule: mail that gets    #
# this far goes in default box #
################################
:0
* .*
default

Offline

#2 2007-10-23 08:16:52

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: procmail issues

I'm not an expert of procmail rules, but I believe that for mailing-list you shouldn't use the From camp to catch them. It can change. Every list should have a List-Id camp which is unique to that list or, simply, you can use the To camp (without .*, type it as it is, with spaces and/or major/minor symbols around the mail address)
Both the To and the List-Id shouldn't change.

Btw, the last rule regarding the inbox it's redundant, procmail will deliver any mail that didn't match any previous rule to the inbox anyway.


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#3 2007-10-24 01:43:31

F
Member
Registered: 2006-10-09
Posts: 322

Re: procmail issues

onearm wrote:

I'm not an expert of procmail rules, but I believe that for mailing-list you shouldn't use the From camp to catch them. It can change. Every list should have a List-Id camp which is unique to that list or, simply, you can use the To camp (without .*, type it as it is, with spaces and/or major/minor symbols around the mail address)
Both the To and the List-Id shouldn't change.

Btw, the last rule regarding the inbox it's redundant, procmail will deliver any mail that didn't match any previous rule to the inbox anyway.

Alright, my revised .procmailrc is the following (also it still does not work and none of my mail gets filtered into either 'inbox', 'arch', or 'dwm'. Do I need an 'mbox' file in each directory of ~/mail/{arch|dwm} ?

[f|~]% cat .procmailrc
MAILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
LOGABSTRACT=no
#VERBOSE=on   used only for debugging
VERBOSE=off
FORMAIL=/usr/bin/formail
NL="
"

##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition !
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into egrep
##one action line follows the conditions, in this case it is a mailbox name

#catch duplicates using formail
:0 Whc: .msgid.lock
| $FORMAIL -D 16384 .msgid.cache

:0 a
$MAILDIR/duplicates

#no more html messages
:0
* ^Content-Type:.*html
$MAILDIR/junk

#now put my mail lists into mailboxes
:0
* ^TO_.*arch@archlinux\.org
$MAILDIR/arch/

:0
* ^TO_.*dwm@suckless\.org
$MAILDIR/dwm/

:0
$MAILDIR/inbox/

Offline

#4 2007-10-24 09:19:25

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: procmail issues

F wrote:

Do I need an 'mbox' file in each directory of ~/mail/{arch|dwm} ?

Nope. If you are using the mbox format for the mail all it's needed is a file with the name of the mailbox (in your case one called "arch",  another "dwm" and yet another called "inbox"). If you want to use the maildir format then the name of the mailboxes should become the directory name containing the three subdirectory cur-new-tmp.

[f|~]% cat .procmailrc
MAILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
LOGABSTRACT=no
#VERBOSE=on   used only for debugging
VERBOSE=off
FORMAIL=/usr/bin/formail
NL="
"

##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition !
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into egrep
##one action line follows the conditions, in this case it is a mailbox name

#catch duplicates using formail
:0 Whc: .msgid.lock
| $FORMAIL -D 16384 .msgid.cache

:0 a
$MAILDIR/duplicates

#no more html messages
:0
* ^Content-Type:.*html
$MAILDIR/junk

#now put my mail lists into mailboxes
:0
* ^TO_.*arch@archlinux\.org
$MAILDIR/arch/

:0
* ^TO_.*dwm@suckless\.org
$MAILDIR/dwm/

:0
$MAILDIR/inbox/

If I'm not wrong (my procmail rules knowledge is a bit rusty as you can imagine smile ) when using the macro ^TO_ you shoulnd't use anything else than the simply mail address. No ".*" no < nor >, only the address.
What I don't understand is why the mail don't get into the inbox at least, they should if not matched with any previous rules.


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#5 2007-10-25 08:03:48

F
Member
Registered: 2006-10-09
Posts: 322

Re: procmail issues

onearm wrote:
F wrote:

Do I need an 'mbox' file in each directory of ~/mail/{arch|dwm} ?

Nope. If you are using the mbox format for the mail all it's needed is a file with the name of the mailbox (in your case one called "arch",  another "dwm" and yet another called "inbox"). If you want to use the maildir format then the name of the mailboxes should become the directory name containing the three subdirectory cur-new-tmp.

[f|~]% cat .procmailrc
MAILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
LOGABSTRACT=no
#VERBOSE=on   used only for debugging
VERBOSE=off
FORMAIL=/usr/bin/formail
NL="
"

##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition !
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into egrep
##one action line follows the conditions, in this case it is a mailbox name

#catch duplicates using formail
:0 Whc: .msgid.lock
| $FORMAIL -D 16384 .msgid.cache

:0 a
$MAILDIR/duplicates

#no more html messages
:0
* ^Content-Type:.*html
$MAILDIR/junk

#now put my mail lists into mailboxes
:0
* ^TO_.*arch@archlinux\.org
$MAILDIR/arch/

:0
* ^TO_.*dwm@suckless\.org
$MAILDIR/dwm/

:0
$MAILDIR/inbox/

If I'm not wrong (my procmail rules knowledge is a bit rusty as you can imagine smile ) when using the macro ^TO_ you shoulnd't use anything else than the simply mail address. No ".*" no < nor >, only the address.
What I don't understand is why the mail don't get into the inbox at least, they should if not matched with any previous rules.

I took your advice and my mail is still not being filtered. I have no idea what i'm doing wrong. Here is the .procmairc I used:

AILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
LOGABSTRACT=no
#VERBOSE=on   used only for debugging
VERBOSE=off
FORMAIL=/usr/bin/formail
NL="
"

##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition !
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into egrep
##one action line follows the conditions, in this case it is a mailbox name

#catch duplicates using formail
:0 Whc: .msgid.lock
| $FORMAIL -D 16384 .msgid.cache

:0 a
$MAILDIR/duplicates

#no more html messages
:0
* ^Content-Type:.*html
$MAILDIR/junk

#now put my mail lists into mailboxes
:0
* ^TO_arch@archlinux\.org
$MAILDIR/arch/

:0
* ^TO_dwm@suckless\.org
$MAILDIR/dwm/

:0
$MAILDIR/inbox/

Offline

#6 2007-10-25 08:19:01

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: procmail issues

Damn, I'm really dumb, sorry. I forgot to add that you don't need to escape the dot in the mail address (like \.), I never did and with my rules and they work.
Type simply the address as it is, without <>, slashes or spaces.

Btw, this is a great site to learn more about procmail's rules.


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#7 2007-10-25 11:37:43

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

Re: procmail issues

Here is my recipie to filter dwm list mails into a dwm/ maildir folder:

:0:
* ^TOdwm@suckless\.org
dwm/

You'll probably need to remove the trailing / on the dwm/ folder since you're using mbox format.  Hope this helps.

Offline

Board footer

Powered by FluxBB