[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: procmail



Lo, on Sunday, December 24, Marcelo Chiapparini did write:

> Hi to all!
> 
> I am using fetchmail+exim+mutt as an email system. All the incomming emails 
> goes to /var/spool/mail/myaccount. I would like now to store the different 
> messages in separate mailboxes files defined in /home/myaccount. I know (from 
> this list! ;)) that this can be done using procmail. I have read the 
> documentation, but I would really appreciate a help regarding the 
> following questions:
> 
> 1) How does procmail start?

If you have fetchmail set to hand messages off to exim (the default), then
exim will automatically start procmail to put the mail in the appropriate
place.  If, on the other hand, you have fetchmail hand it off directly to
your MDA, just use procmail as your MDA.  Either way, you'll need a
.procmailrc file.

> 2) How does look the syntaxis in the .procmailrc file in order to move 
> emails from /var/spool/mail/myaccount to the mailbox 
> /home/myaccount/mail/mymailbox? I found the examples in procmailrcex a bit 
> obscure regarding this point.

Well, procmailrc(5) and procmailex(5) are the best (only?) sources for this
sort of information.  In case it helps, though, I've attached a copy of my
.procmailrc that's reasonably well commented.  Also, check out
/usr/share/doc/procmail/examples/.

HTH,

Richard


####################################################################
##
## Procmail config file; handles mail filtering.
##
## $Id: procmailrc,v 1.2 2000/12/22 17:15:07 cobbe Exp $
##
###################################################################

## The basic idea: save all of the messages that I want to see into the
## appropriate folder (In for normal messages, and then folders for various
## mailing lists), and leave all others to go to the autospam folder.  You
## could also route these to /dev/null, but I want to make sure I don't
## miss anything by default.
##
## The colon after the :0 tells procmail to use locking so my MUA doesn't
## try to read the mail file while procmail is writing it.  Good way to
## lose mail.

############ open SMTP relays:
:0 :
* ^Received:.*alpha2.tsulaw.edu.*
/home/cobbe/Mail/.spools/autospam

############ messages directly to me
:0 :
* ^TO.*cobbe.*
/home/cobbe/Mail/.spools/In

# messages to root, bounced to me
:0 :
* ^TO.*root.*
/home/cobbe/Mail/.spools/In

############ info-cvs:
:0 :
* ^X-BeenThere:.*info-cvs@gnu.org
/home/cobbe/Mail/.spools/info-cvs

############ messages from the linux kernel announce list
:0 :
* ^TO.*linux-kernel-announce.*
/home/cobbe/Mail/.spools/In

############ messages from North Texas Linux User's Group
:0 :
* ^TO.*@.*ntlug.org.*
/home/cobbe/Mail/.spools/In

############ PLT Scheme discussion list
:0 :
* ^Sender: *owner-plt-scheme*
/home/cobbe/Mail/.spools/plt-scheme

############ Debian lists
:0 :
* ^Resent-From:.*debian-user@lists.debian.org
/home/cobbe/Mail/.spools/debian-user

:0 :
* ^TO.*debian-user@debian.lists.org
/home/cobbe/Mail/.spools/debian-user

:0 :
* Resent-To:.*debian-user@debian.lists.org
/home/cobbe/Mail/.spools/debian-user

:0 :
* ^From:.*@lists.debian.org
/home/cobbe/Mail/.spools/debian

:0 :
* ^Resent-From:.*@lists.debian.org
/home/cobbe/Mail/.spools/debian

###############
#default rule: put everything not matched above in the autospam folder

:0 :
* .*
/home/cobbe/Mail/.spools/autospam

Reply to: