🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #9475

auto-archive for mailing lists

#9475
From: Paul Stravers
Date: Mon, 02 Sep 1991 20:35
61 lines
3161 bytes
I thought somebody might like this... The following code tells VM how to
recognize and archive messages that come from a mailing list. It archives
message from a mailing list, say "some-mailing-list", in a folder named
"M-some-mailing-list". Messages that do not belong to to a mailing list go in a
folder named after the sender. Of course, you will have to adapt the variable
vm-mailing-lists to match the mailing lists that *you* receive.

I've used this code with vm-version 4.41 for a few months and it appears to
work satisfactory...   I never use UUCP, so I don't know what happens with
UUCP-style addresses.

Have fun!
        -Paul

===============================================================================

(defvar vm-mailing-lists
	'(
	  "nelsis-bulletin"
	  "comp-net"
	  "piadas"
	  "gwm-talk"
	  "lpf-nl"
	  "jircc"
	  )
	"*List of strings naming the mailing lists that VM should know about. VM
archives mailing-lists that appear in vm-mailing-lists in their own folder. See
also info on function vm-make-mailinglist-regexp.")

(defun vm-make-mailing-list-regexp (listname)
       "This function is used only to construct the variable vm-auto-folder-alist.
It returns the cons of a regexp and a foldername. The regexp is supposed to
match the To, Cc, or Sender field in the message. The foldername is the LISTNAME
prepended with \"M-\" and the result is used as the name of the folder to
append the message to."
       (cons
	(concat
	 "\\<" listname
	 "\\|" (upcase listname)
	 "\\|" listname "-list"
	 "\\|" (upcase listname) "-LIST"
	 "\\>")
	(concat "M-" listname)))

;; Following data structure determines the name of the folder to save mail in.
(setq vm-auto-folder-alist
      (`
       (;; First we check if this is a mailing-list. The name of the mailing-list
	;; is usually in the To-field, but sometimes in the Cc- or Sender-field:
	(, (cons "To"     (mapcar 'vm-make-mailing-list-regexp vm-mailing-lists)))
	(, (cons "Cc"     (mapcar 'vm-make-mailing-list-regexp vm-mailing-lists)))
	(, (cons "Sender" (mapcar 'vm-make-mailing-list-regexp vm-mailing-lists)))
	;; if it's not a mailing list, then use sender's name as folder name:
	("From"
	 ("\\([^ <%@]+\\)[%@]" .
	  (buffer-substring (match-beginning 1) (match-end 1)))
	 ("\\([a-zA-Z0-9]+\\)" .
	  (buffer-substring (match-beginning 1) (match-end 1))))
	)))

===============================================================================
Technical Details
Message-ID: <STRAVERS.91Sep2153548@donau.et.tudelft.nl>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!donau!donau.et.tudelft.nl!stravers

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,fda9e0e9dfea8e8c,start
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1991-09-02 07:51:09 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!donau!donau.et.tudelft.nl!stravers
From: stravers@donau.et.tudelft.nl (Paul Stravers)
Newsgroups: gnu.emacs.vm.bug
Subject: auto-archive for mailing lists
Message-ID: <STRAVERS.91Sep2153548@donau.et.tudelft.nl>
Date: 2 Sep 91 20:35:48 GMT
Sender: news@donau.et.tudelft.nl (UseNet News System)
Reply-To: stravers@donau.et.tudelft.nl
Distribution: gnu
Organization: Delft University of Technology, the Netherlands
Lines: 61
Nntp-Posting-Host: donau.et.tudelft.nl