Zhiliang | 9 Feb 21:32
Gravatar

(unknown)

I have the following procmail recipe to auto-respond upon certain
criteria.  The recipe "works" in the way to match and to send reply email;
however the sent email only has mail header without mail body (empty), 
that I could not get it why mail body is "not formed" or "not sent":

SUBJADDR =`formail -xSubject: |perl -pe 's/.*sub.*\s+([^\s]+\@[^\s]+)/$1/sg;s/^\s+//g;s/\s+$//g;'`
HISTMARK = `date +"%s"`

:0
* ^TO.*watchdog <at> my.domain
| (formail -i"Subject: Confirmation needed" \
       -I "To: $SUBJADDR"; \
       echo " "; \
       echo " "; \
       echo "Confirmation mark: $HISTMARK") | $SENDMAIL -oi $SUBJADDR

I tried single or double 'echo " ";' lines to leave 1 or 2 space lines 
between mail header and body - that makes no difference.  Any suggestion 
would be appreciated.

Zhiliang
LuKreme | 9 Nov 21:13

Organizing

I’m thinking about taking a run at organizing, really organizing, all the procmail recipes for my
several email accounts.

I have, needless to say, code that is shared, duplicated, or nearly duplicated across my 4 primary
accounts,a bout a half-dozen secondary accounts, and then a portion of that code is shared over to most of
the user accounts on the system.

Before I got started, I wanted some recommendations on how, exactly to go about this.

I was considering something along these lines, with * items being things the are already done.

* procmailrc file with basic variable extraction, mail backup

* hand off processing to .procmailrc if user has one, otherwise process for spam

In .procmailrc
call external basicrc file for all users to process list messages, + addressing, and set default delivery
locations (like .$ARG/ or .SPAM/)

process local rc files (~/.procmail/.*rc)

call a deliveryrc file that actually delivers the mail and logs to user’s log file (~/logs/pm.10-11-2011.log)

I figure the deliveryrc and basicrc can be the same file for everyone if I do it right, though I am unsure how to
load arbitrary files in the user’s ~/.procmail/ folder.

Does all of this sound reasonable? Does anyone have any hints (or samples) on something like this? What I
envision is something that is going to be necessarily a lot more complicated than what I am currently
doing, but will end up being more flexible and easier to manage since most files will just be shared between
all users. I may even look into doing something like creating a library of procmail includes that a user
(Continue reading)

Picon
Favicon

Querying a DB to determine destination mailbox for an email using Procmail

Requirement: I need to devise a solution where a procmail script can dynamically determine the final
destination mailbox by querying a database for a particular keyword to get the corresponding mailbox.

Approach I have in mind:
Based on my knowledge of procmail so far, I envision the following steps but wanted some expert opinion on
finding the right approach.
1. Use a database to maintain a key/value pair type information for a keyword and a corresponding mailbox
name. This information may be maintained manually or using a custom application (outside of procmail).
2. Write a Perl script which takes an input parameter from procmail (I have not done this before but I believe
procmail can call a Perl script and just pass an argument in the call). 
3. The Perl script performs the actual query to database for a given keyword to find the corresponding
mailbox name.
4. The script then returns the mailbox name to the procmail script/recipe that invoked the Perl script.
5. The procmail recipe then directs that email (which had the keyword) to its intended mailbox (which was
dynamically determined using the query executed by the PERL script).

Is the above approach an appropriate way to implement the requirement outlined at the beginning of this email?

If yes, are there any conditions that I missed in my approach that I need to be mindful of before beginning
research and development for this solution using this approach?

If no, can you suggest an alternate way of achieving this requirement?

Thanks and regards,
Komal

------------------------------------------------------------------------------------------------------------------------------------------------------------------
Komal Tagdiwala | IT Engineer | Cisco Systems, Inc.| Contact Center Applications & Technologies
400 E Tasman Dr | SJC 12/3 | San Jose, CA 95134 | ktagdiwa <at> cisco.com | Office: (408)527-2163
------------------------------------------------------------------------------------------------------------------------------------------------------------------
(Continue reading)

Zhiliang | 14 Oct 00:55
Gravatar

sed syntex in procmailrc question


I have a recipe wish 'sed' in one of my Smartlist rc, like:

    sed 's/SUBJET/'"$SUBJ"/g

which works fine.  I forgot where did I copied it from but have been 
puzzled by its syntex with respect to the use of the single quotes "'". 
Following what's described in sed tutorials I made it:

    sed 's/SUBJET/"$SUBJ"/g'

and it fails.  Could someone kindly point me to a "right" resource I 
should check? (I wondered in between sh/csh shell scripting syntex 
and general RE, among several other resources having things "alike"; Or 
is it really a 'sed/awk' thing that I have not really get into?)

Thanks in advance,

Zhiliang
LuKreme | 12 Oct 16:16

Long line of OR

I have a recipe that has a very long line of matches

* 9876543210^0 ! VAR ?? (aa|apsumo|beni|candy|casa|cf|cpr|db|dbl|dhosts|fb|glue|gofobo|hita|ic|llc|logi|micr|netf|ocb|plus|pl|rcc|rk|rocb|scv|snap|spot|su|tor|tripa|twit|v365|vm|root|admin|rsmith|bsmith)

and it occurred to me there might be a reason not to do that.

--

-- 
"...Life is not a journey to the grave with the intention of arriving
safely in one pretty and well-preserved piece, but to slide across the
finish line broadside, thoroughly used up, worn out, leaking oil, and
shouting GERONIMO!!!" -- Bill McKenna
Picon
Favicon

Invitation to connect on LinkedIn

LinkedIn

Diego Lima requested to add you as a connection on LinkedIn:

Manu,

I'd like to add you to my professional network on LinkedIn.

 
View invitation from Diego Lima

 

DID YOU KNOW you can use your LinkedIn profile as your website?

Select a vanity URL and then promote this address on your business cards, email signatures, website, etc.

 

© 2011, LinkedIn Corporation

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail <at> lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
Robert Bonomi | 25 Sep 23:09

unexpected procmail recipe behavior


The procmail manpages say that procmail regexes behave "exactly" as egrep ones.

I'm baffled as to why this conditon:
  * ^References:.*[<]\/[^>][^>]*
sets MATCH to the  _first_ Message-ID on the line, and not the _last_ one.

Standard regex definition is that repeat patterns are 'greedy' -- i.e.,
that given multiple matches at the same starting point, the -longest-
match will be chose.

Thus, to my understanding, the sequence '.*[<] should match evrything up to
the -last- "<" on the line.

and, in fact, using a sed(1) substitution "s/^.*[<]([^>][^>]*)[>].*$/\1/"
I do get the desired last tiem.

Can anyone 'explain this thing to me" or (with apolgies to The Weavers)
should this old fool just put his chamberpot on his head, saddle up his
milk cow, and ride away ?  *GRIN*

I've had to re-write 'modern egrep'-compliant regexes many times, to get
the desired behavior out of procmail. But, how to re-write this one, where
there may be a variable number of '<...>' items on the line, has got me
stumped.

Does anybody have a _detailed_ description of exactly how procmail's 
'internel pattern-match' works?  Saying it 'works like egrep(1)' is 
woefully incomplete/inaccurate, given the changes to egrep's behavior 
that have occured over the years.

You know 'minor', 'insignificant', things like which 'repeat' characters
it recognizes, whether it uses "("/")" or "\("/"\)"  for grouping, whether
it recognizes 'named' character classes -- e.g. " [:upper:]",  how it
resolves 'ambiguous' matches,  etc.    <wry grin>
Noah | 3 Sep 20:01

Command time limit exceeded:, "/usr/bin/procmail"

Hi,

so I am receiving notifications that sometimes incoming mail is bouncing 
due to 'Command time limit exceeded:    "/usr/bin/procmail"'

What is the best way to figure out what is causing this.  I am running 
spamd and also invoking spamc from the .procmailrc .

what is the best method to controlling spam?  using spamd or having a 
local invocation of spamc in each users' homedir .procmailrc ?

here is my procmailrc -  is this file fairly complete or are there other 
options I should be considering?

--- snip ---

PATH=/usr/local/bin:/bin:/usr/bin:$PATH
HOME=/home/≤user>
MAILIN=$HOME/mail
DEFAULT=/var/mail/≤user>
#MAILDIR=$HOME/Mail
#LOGFILE=$MAILDIR/from
LOCKFILE=/var/mail/≤user>.lock
NULL=/dev/null

:0fw: spamassassin.lock
| /usr/bin/spamc

:0
* ^X-Spam-Status: Yes
$MAILIN/Spam

--- snip ---
Picon

Procmailrc start

Hi,

Yes I am a newbie to procmail, so I ask that you point me to some
information so I can start using and understanding this program.

Be kind, I am a KDE user with limited cli usage.

I would like to start using Procmail for email filtering as I currently
have almost 600 filters listed in Mozilla Thunderbird moving email to an
equally large number of folders. The Mozilla filters are failing on
occasions and this is only due to the large number. Doing the recipes in
procmail is going to be LOTS of fun :|

Unfortunately this is a production system and there is no backup. That
is being remedied but in the meantime the procmail filters still need
setting up.

I have obtained and had an introductory read of the book called Procmail
Companion (McCarthy), the procmail homepage, and done significant Google
searching as well as fairly extensive man page work, all without being
able to find an explanation of what the 'default' lines of code would be
for a procmailrc file. Is there a list of the lines of code that could
go in the start of the file, if so where?

If not, what are the bare minimum lines? A full listing of them would be
better as then I can add just the ones needed.

I would assume the following lines of code before the recipes:

Maildir
log
verbose
path

What else before the recipes start?

Appreciated
Hylton
--

-- 
========================================================================
Hylton is a Lions Club member of Lions Club of Fish Hoek (District 410A)
http://www.fishhoeklionsclub.org.za being part of the worlds largest NGO
========================================================================
LuKreme | 18 Aug 12:57

Domain based sorting

A certain person in my household who shall remain nameless has a habit of signing up for email newsletters or
whatever at a rather astonishing rate, and I’ve been unable to keep up with any sort of sorting
methodology that can help her.. errr, can help this nameless person keep up with the mail.

I have tried to setup procmail so that ‘real’ mail gets sent in to the inbox and everything else gets sent
into a misc box, but too much ‘real’ mail misses the inbox and it is difficult (for some reason I don’t
understand) for this person to search and find the important mail.

Now, this isn’t spam, it’s stuff like amazon, woot, group on, land’s end, and several dozens of
others, and all email that, at least in theory, is ‘wanted’

So, my idea was instead of dumping it into Misc.2011-08 I would dump it in misc.<domain> and then as long as
she has some clue as to where the mail might be from, she should be able to find it. Er, this unnamed person,
that is.

this would be simple if the stupid mailers used Precedence: bulk like they are SUPPOSED to, but let’s not
go there.

So, my idea is this:

(cribbed from Sean)

# I’m already doing from here to defining FROM_DOMAIN anyway in the procmailrc
:0 h
CLEANFROM=|formail -IReply-To: -rtzxTo:

# username portion
:0
* CLEANFROM ?? ^\/[^@]+
{ FROM_USER=$MATCH }

# domain portion
:0
* CLEANFROM ?? @\/.*
{ FROM_DOMAIN=$MATCH }

# Process spam and friends and other real mail here

# add this
:0
* ! FROM_DOMAIN ^^^^
.Misc.${FROM_DOMAIN}/

So, my question isn’t so much how to do this, but rather if anyone has any comments, ideas, suggestions,
warnings, caveats, &c?

One thing I will have to fix is that the FROM_DOMAIN will contain, for example, mx3.domain.tld and I want it
to contain just “domain”. That’s trivial though (And in fact, I may have to check the procmailrc,
but it might already be grabbed into a variable I’ve forgotten about).

--

-- 
Once again I teeter at the precipice of the generation gap.
Edward McKeown | 16 Aug 16:48
Picon

procmail and SpamBayes issues

hello

for some reason when my email is processed with procmail and SpamBayes
the email is lost.  I am new at this and I am not sure why. someone
told me that my procmailRC is wrong...  I keep on getting an procmail:
Program failure (2) of "/usr/bin/python" ERROR not sure how to correct
this any help would be much appreciated.  I know that the file is
where it is supose to be but for some reason it cannot be open.

I have included my log and also the procmail config file.

thanks

=======
LOG

From xxxxx <at> abc.com  Sun Aug 14 18:19:13 2011
 Subject: test Sunday
 Folder: /var/mail/edward                                                 2910
procmail: [1818] Sun Aug 14 19:37:25 2011
procmail: Assigning "LOGABSTRACT=all"
procmail: Assigning "MAILDIR=/Users/edward/Mail/Dovecot"
procmail: Assigning "SPAMBAYESDIR=/usr/local/cutedge/spambayes"
procmail: Assigning
"DELIVER=/usr/local/cutedge/dovecot/libexec/dovecot/deliver -c
/usr/local/cutedge/dovecot/etc/dovecot.conf"
procmail: Assigning "INCLUDERC=/etc/rc.custom1"
procmail: Assigning "LASTFOLDER=cat >> /Users/edward/postbayeslog"
From sentto-2240464-41435-1313364858-xxx=abc.com <at> returns.groups.yahoo.com
 Sun Aug 14 19:37:25 2011
 Subject:  Re: test
 Folder: cat >> /Users/edward/postbayeslog                               15416
procmail: Executing "cat >> /Users/edward/postbayeslog"
procmail: Executing "/usr/bin/python,/sb_filter.py,-f,-p,/hammiedb.pck"
/usr/bin/python: can't open file '/sb_filter.py': [Errno 2] No such
file or directory
procmail: Program failure (2) of "/usr/bin/python"
procmail: Rescue of unfiltered data succeeded
procmail: No match on "^X-SpamBayes-Classification: spam"
procmail: Incomplete recipe
procmail: Assigning
"PATH=/Users/edward/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11/bin"
From sentto-2240464-41435-1313364858-xxx=abc.com <at> returns.groups.yahoo.com
 Sun Aug 14 19:37:25 2011
 Subject: Re: test
 Folder: /var/mail/edward                                                15416

PROCMAIL RC

UMASK7

SHELL=/bin/sh
LOGFILE=/Users/tempo/procmail.log
VERBOSE=on
MAILDIR=/Users/tempo/Mail/Dovecot
SPAMBAYESDIR=/usr/local/cutedge/spambayes
DELIVER='/usr/local/cutedge/dovecot/libexec/dovecot/deliver -c /usr/
local/cutedge/dovecot/etc/dovecot.conf'

INCLUDERC=/usr/local/cutedge/spambayes/etc/rc.custom1

:0 fw
| /usr/bin/python /usr/local/cutedge/spambayes/sb_filter.py -f -p /
usr/
local/cutedge/spambayes/hammiedb.pck

:0
* ^X-SpamBayes-Classification: spam
{
INCLUDERC=/usr/local/cutedge/etc/rc.sendtodevnull

:0
|  -m Spam
#.Spam/
}

INCLUDERC=/usr/local/cutedge/spambayes/etc/rc.custom2

:0 w
|

Gmane