[wplug] procmail help

Chester R. Hosey chosey at nauticom.net
Sun May 21 12:45:31 EDT 2006


Gentgeen wrote:
> On Fri, 19 May 2006 11:00:31 -0400
>
> Right now, I use fetchmail to grab mail from 3 different accounts, My
> main account (This one), the family account (the kvsquire at comcast.net)
> and my 7 year old daughters account (bratzfan7 at comcast.net).  Mail from
> all three accounts have to come to my account (I want to see my mail,
> the family mail, and my daughters mail).  The family account also has to
> go to my wife's account, and of course me daughters account has to go to
> her. 
> 
> Fetchmail sends it along to procmail who passes the mail through
> ClamAssassin and SpamAssassin before senting it along to the personal
> accounts.

Gotcha. What you want to do is grab the mail, add a header, and deliver
it to yourself and an appropriate second mailbox.

Presently you're fetching from an account twice, delivering it once to
yourself and once to a second mailbox. This is because it's not clear
how to grab it once, and sort it out later.

Procmail can forward mail to another mail address; if you use a
"non-delivering" recipe for this you can have the mail also sent to your
own account. The only problem remaining is to identify the original mail
itself; adding a header is actually pretty easy using the 'formail'
utility. You can have fetchmail pipe the message through formail to add
an account-specific header before passing it on to procmail.

# Configuration created Wed Jan 12 12:42:41 2005
set postmaster "kevin"
set syslog
set invisible
set daemon 600
########################################
# This is Kevin's Linuxmail account
########################################
poll imap.linuxmail.org with proto POP3
       user 'gentgeen:linuxmail.org#linuxmail.org' there
       with password 'XXXXXX'
       is 'kevin' here
       options fetchall
       mda '/usr/bin/procmail -d kevin'

########################################
# This is the Comcast main account
#
# note that mail is passed through formail,
# and that mail is not kept on the server
########################################
poll mail.comcast.net with proto POP3
        # Drops Comcast mail into Kevin's account
        user 'kvsquire at comcast.net' there
        with password 'YYYYYY'
        is 'kevin' here fetchall
        mda '/usr/bin/formail -A "X-Original-Account:
kvsquire at comcast.net" | /usr/bin/procmail -d kevin'

########################################
# This is Ariel's Comcast account
#
# same as above...
########################################
#poll mail.comcast.net with proto POP3
        # Drops a copy of Ariel's mail into Kevin's account
        user 'bratzfan7 at comcast.net' there
        with password 'ZZZZZZ'
        is 'kevin' here fetchall
        mda '/usr/bin/formail -A "X-Original-Account:
bratzfan7 at comcast.net" | /usr/bin/procmail -d kevin'


This will accept Comcast mail, add a header to identify the correct
original account, and deliver it to you only. Now, you'll have to tell
procmail to deliver the mail to both accounts. There are a few ways to
do this, but I think the following is relatively clear:


#---------------------------------
# Family Email account
:0:
* ^X-Original-Account:.*kvsquire at comcast.net
{
	# 'c' means 'copy': this forwards a copy to
	# Val and keeps processing. Without the 'c' it
	# would forward the copy and stop immediately.
	:0 c
	! val

	# This recipe will place mail into Kevin's mailbox.
	:0
	$MAILDIR/Other_Acct/kvsquire/.
}

#---------------------------------
# Ariel's Email account
:0:
* ^X-Original-Account:.*bratzfan7 at comcast.net
{
	# This forwards a copy to Ariel and
	# keeps processing.
	:0 c
	! ariel

	# This recipe will place mail into Kevin's mailbox.
	:0
	$MAILDIR/Other_Acct/kvsquire/.
}

#---------------------------------
# This drops any Unsorted mail into the INBOX
:0
$DEFAULT/.

#----------------------------------


Of course, if any of this is unclear or I'm misinterpreted something,
please let me know and I'd be glad to try to help clarify. If you do get
it working, please let me know also!

Chet


More information about the wplug mailing list