Tue 98-02-10 Timothy Luoma <luomat(_at_)luomat(_dot_)peak(_dot_)org>
list.procmail
| I have been trying to piece this together from old emails and it is failing.
|
| luomat+Lists/procmail(_at_)luomat(_dot_)peak(_dot_)org
|
| What I would like to do is test for the existence of the directory if there
| is a "/" present (ie $MAILDIR/Lists or $MAILDIR/Lists/Misc/)
|
| If the directory is not there, I want to try 'mkdir' and then I want to put
| the message in whatever mailbox is BLAH, ie:
I updated one of my subroutines to handle plus addressing. Get
newest pm-code.shar and do this. All this is stormed from my mind and
thusly untested, so you may have to fix some details when you actually
install it.
I have also included the short man page of RC_EMAIL to the end,
so that the used variables, like ACCOUNT2 can be better understood.
Cheers!
jari
PMSRC = where you keep your prcmail rc files
RC_EMAIL = $PMSRC/pm-jaaddr.rc
MY_LOGIN = "(luomat1login|luomat2login)"
:0
*$ ^TO_\/$MY_LOGIN.*
{
# We matched address that is pointing to our account,
# explode it.
INPUT = $MATCH
INCLUDERC = $RC_EMAIL
# ACCOUNT2 contains all after plus sign, the directory
#
dir = $MAILDIR/$ACCOUNT2
# Did we have the dir there? ACCOUNT2 is empty if it was simple
# foo(_at_)site(_dot_)com(_dot_) If there is no slash, then it was
foo+bar(_at_)site(_dot_)com
#
# We expect: foo+dir/@site.com
#
#
:0
* ACCOUNT2 ?? [/]
{
ok = "yes"
# If directory does _not_ exist, try to create one.
# If create failed, flag error and change status
:0
*$ ! ? test -e $dir
*$ ! ? mkdir $dir
{
ok = "couldn't create $dir"
}
# Drop to directory if it existed or was created,
# otherwise skips this and goes delivering to DEFAULT
:0
* ok ?? yes
$dir
}
}
Pm-jaaddr.rc -- extract 'foo(_at_)some(_dot_)com' email address from variable
INPUT
Description
This includerc extracts the various components of email address
from variable INPUT.
Example input
"From: foo+procmail(_at_)this(_dot_)site(_dot_)com (Mr. foo)"
Returned values
ADDRESS "foo+procmail(_at_)this(_dot_)site(_dot_)com"
containing the email address without <>
ACCOUNT "foo+procmail"
all characters before @
ACCOUNT1 "foo"
if plus found: account1+account2(_at_)site
ACCOUNT2 "procmail"
if plus found: account1+account2(_at_)site
SITE "this.site.com"
all characters after @
DOMAIN "site.com"
the main domain, preceding words in site are
considered subdomain (local) addresses.
sub.sub.domain.net
"com"
NET last characters after last period ( net,com,edu ...)
Variable ERROR is set to "yes" if INPUT wasn't recognized or parsing
the address failed.