##### lm_mailchimp.rc # # Resource file for procmail. # Filters list messages from lists handled by mailchimp. # # Variables, in (set before calling): # LISTNAME List name (e.g. between [...] in Subject:). # Mailchimp: Username part of From: or Reply-to: address! # LISTEMAIL Address of list (leave out part after @ and any generic # parts like -return); defaults to LISTNAME. # Mailchimp: Value of X-MC-User:! # LISTSERVERDOMAIN Domain of the list server handling this list # (the part after @). # LISTFOLDER Where to store email if it's from this list; # nothing will be stored if this is empty. # LISTFOLDER_UMASK If set, umask to use when saving to LISTFOLDER. # PROCDIR Directory where the procmail resource files are stored. # These may be unused by some of the listserver handlers (lm_*.rc): # LISTTO Your address to which list emails are sent. # Variables, returned: # ISTHISLIST Set to "1" if email is from this list, unset otherwise. # LISTEMAIL Unset. # # Run with e.g.: # LISTNAME="Weather Discussion" # LISTEMAIL="weatherdisc" # LISTSERVERDOMAIN="weather.net" # LISTFOLDER=somepath/weather-List # INCLUDERC=yourpath/lm_mailchimp.rc # in your $HOME/.procmailrc (you can leave out LISTEMAIL if it's the same as # LISTNAME). # # The latest version is always available from: # http://volker.top.geek.nz/soft/procmail/ # # Copyright (C) by Volker Kuhlmann # http://volker.top.geek.nz/contact.html # Released under the terms of the GNU General Public License (GPL) Version 2. # See http://www.gnu.org/ for details. # # Volker Kuhlmann # 27 Mar 2020 Created from lm_template.rc. # 29 Mar 2020 Move examples to separate file. # ## LISTEMAIL defaults to LISTNAME :0 * LISTEMAIL ?? ^^^^ { LISTEMAIL=$LISTNAME } ## Set ISTHISLIST if match occurs ISTHISLIST= LSERVERDOM__="(mailchimp\.com|mailchimpapp\.net|list-manage\.com|list-id\.mcsv\.net|mcsignup.com)" ## Admin (subscribe/unsubscribe) email: # :0 * $ ^X-Mailer: MailChimp * $ ^X-Campaign: mailchimp$LISTEMAIL\. * $ ^X-campaignid: mailchimp$LISTEMAIL\. * $ ^X-Report-Abuse:.*//$LSERVERDOM__/ * $ ^DKIM-Signature:.*$LISTNAME=(3D)*$LISTSERVERDOMAIN@[a-z0-9_.-]*\.$LSERVERDOM__; * $ ^X-MC-User: $LISTEMAIL # Below is only for admin emails: * $ ^Sender:.*=$LISTSERVERDOMAIN@[a-z0-9_.-]*\.$LSERVERDOM__> { ISTHISLIST=1 } ## List email: # :0 * LISTSERVERDOMAIN ?? ^\/[a-z0-9_-]* { LISTSUBDOMAIN__=$MATCH } # :0 * $ ^X-Mailer: MailChimp * $ ^X-Campaign: mailchimp$LISTEMAIL\. * $ ^X-campaignid: mailchimp$LISTEMAIL\. * $ ^X-Report-Abuse:.*//$LSERVERDOM__/ * $ ^DKIM-Signature:.*$LISTNAME=(3D)*$LISTSERVERDOMAIN@$LSERVERDOM__; * $ ^X-MC-User: $LISTEMAIL # Below is only for list emails: * $ ^List-ID: ${LISTEMAIL}mc list * $ ^List-ID:.*\.$LSERVERDOM__> * $ ^List-Unsubscribe:.*//$LISTSUBDOMAIN__\..*\.$LSERVERDOM__/ { ISTHISLIST=1 } ## If match occurred and LISTFOLDER is set, save to LISTFOLDER :0 * ISTHISLIST ?? ^^1^^ * ! LISTFOLDER ?? ^^^^ { :0 * ! LISTFOLDER_UMASK ?? ^^^^ { UMASK=$LISTFOLDER_UMASK } :0 : $LISTFOLDER } LISTEMAIL= LSERVERDOM__= LISTSUBDOMAIN__= ##### EOF lm_mailchimp.rc