procmail
[Top] [All Lists]

Re: How to auto-process emails based with header?

2010-10-18 20:13:40
On Mon, Oct 18, 2010 at 09:00:21PM +0200, Michelle Konzack wrote:
Oops

  :0E
  * ? test -f ${TDTP_INC}/MAILINGLISTS_get_listname
  { INCLUDERC=${TDTP_INC}/MAILINGLISTS_get_listname }

Remove this part which is in your case useless

  :0
<snip>
  .Mailinglists.${LISTNAME}/

This create a MAILDIR Folder for each mailinglist, but if you need  FLAT
MAILBOX files, remove the / at the end of the line.

  :0
  * ? test "${TDTP_SPAM_AT_END}" = "true"
  ${TDTP_SPAM_PREFIX}.${TDTP_DATE_PREFIX}.Mailinglists/

Remove this part which is in your case useless and place

    :0
    .Mailinglists/

here.

}

and theis brace was accidently not removed by me...

Thanks for so patience and so kind of you!

I've tried it, it works somehow, but...:

1. it says errors when processing:

    LISTNAME: Undefined variable.

2. It filters all other mails into .Malinglists., though I've put the
rule in front of my other rules. I tried the following rule but with
no lucky:

#=====================================================================
# Get the listname
#=====================================================================

:0
* ^List-Post:.*mailto:[-(_dot_)(_at_)a-zA-Z0-9]+>
* ^List-Post:.*mailto:\/[-(_dot_)(_at_)a-zA-Z0-9]+
{ LISTNAME="${MATCH}" }

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

:0E
* $ ^X-Mailing-List:.*[${ST}]\/.*
{ LISTNAME="${MATCH}" }

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

:0E
* $ ^X-BeenThere:.*[${ST}]\/.*
{ LISTNAME="${MATCH}" }

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

:0E
* $ ^Sender:.*[${ST}]\/.*
{ LISTNAME="${MATCH}" }

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

:0E
* $ ^List-ID:.*[${ST}]<[-.a-zA-Z0-9]+>
* $ ^List-ID:.*[${ST}]<\/[-.a-zA-Z0-9]+
{ LISTNAME=`echo "${MATCH}" |sed 's|\.|@|' ; :` }

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

#=====================================================================
#  Filter into the folders
#=====================================================================

LISTNAME=`echo "${LISTNAME}" |tr '.' '_' |sed 
'y|ABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyz|' |sed -e 
's|-bounces@||' ; :`

:0
.Mailinglists.${LISTNAME}/

Thanks again!

-- 
Regards,
Yue Wu

Key Laboratory of Modern Chinese Medicines
Department of Traditional Chinese Medicine
China Pharmaceutical University
No.24, Tongjia Xiang Street, Nanjing 210009, China
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail