procmail
[Top] [All Lists]

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

2010-10-16 09:34:27
Hello Yue Wu,

Am 2010-10-16 22:20:22, hacktest Du folgendes herunter:
Hello list,

Say I have emails that contain header:

List-ID: <ID>

How to let procmail auto-process all emails that have it into
maildir ml-ID/ ?

Maybe something like:  (a little bit striped down)

---[ '/usr/lib/tdtools-procmail/MLAILINGLISTS' ]------------------------
<snip>
  #=====================================================================
  # 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|\.|@|' ; :` }

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

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

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

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

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

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

Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems(_at_)tdnet France EURL       itsystems(_at_)tdnet UG (limited 
liability)
Owner Michelle Konzack            Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz                 Kinzigstraße 17
67100 Strasbourg/France           77694 Kehl/Germany
Tel: +33-6-61925193 mobil         Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4michelle(_at_)jabber(_dot_)ccc(_dot_)de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/
____________________________________________________________
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