[mew-int 01722] Re: spam question
Tatsuya Kinoshita
tats at example.com
Wed Feb 11 23:57:48 JST 2004
On February 10, 2004, [mew-int 01721],
henri (at qais.com) wrote:
> (setq mew-spam: "X-Spam-Flag:")
>
> (defun mew-spam-assassin (val)
> (let ((case-fold-search t))
> (if (string-match "yes" val) ?D)))
>
> (setq mew-inbox-action-alist
> '(("X-Spam-Flag:" mew-spam-assassin)))
>
>
> but when i get new mail the spam is not automatically marked
> w/ an "o"
You should combine Spamassassin with your MTA. The `X-Spam-Flag'
field should be added to the messages before Mew retrieves them.
If "X-Spam-Flag: Yes", then the `D' mark will be added to the
messages.
*
I have an experimental code for Mew 4 + bogofilter/spamc. For
automatically putting the `D' mark on messages in the +inbox
folder without MTA configuration, the external program
(`bogofilter' or `spamc') is called frequently. (The call
conflicts with Mew's asynchronous feature. So, this code won't
be merged into Mew 4.)
-----
;;; An experimental ~/.mew.el for Mew 4 + bogofilter/spamc
;;; Author: Tatsuya Kinoshita
;;; Unlimited permission is granted to use, copy, distribute, and/or modify
;;; this program. There is NO WARRANTY.
(setq my-mew-summary-form-mark-spam t) ;; If non-nil, the mark specified by 'my-mew-mark-spam' is automatically put on spam messages.
(setq my-mew-spam-prog-type 'bogofilter)
;;(setq my-mew-spam-prog-type 'spamc)
(setq my-mew-prog-bogofilter "bogofilter")
(setq my-mew-prog-spamc "spamc")
(setq my-mew-mark-spam mew-mark-delete)
(defadvice mew-summary-form-mark (after mark-spam activate)
(if my-mew-summary-form-mark-spam
(let ((fld (MEW-FLD))
file)
(if (and
(mew-folder-inboxp fld)
(not (string= ad-return-value (char-to-string my-mew-mark-spam)))
(mew-which-exec my-mew-prog-bogofilter)
(setq file (mew-expand-folder fld (MEW-NUM)))
(file-exists-p file)
(if (eq my-mew-spam-prog-type 'bogofilter)
(= (call-process my-mew-prog-bogofilter file nil nil)
0)
(> (call-process my-mew-prog-spamc file nil nil "-c")
0)))
(setq ad-return-value (char-to-string my-mew-mark-spam))))))
-----
Another solution is in Mew 4.0.64 (latest CVS version). The
mew-summary-cmd-mark function (`"' in Summary) is now available.
You can call an optional command (e.g. your sh script) with the
grep interface for putting the `*' mark on messages. I give the
following sample codes. (Type `" TAB RET y RET' for putting
the `*' mark on spam messages.)
----- ~/.mew.el -----
(setq mew-prog-grep-list '(("my-grep-bogosity")))
-----
----- my-grep-bogosity -----
#!/bin/sh
# my-grep-bogosity: print filenames matching a pattern with X-Bogosity
# Author: Tatsuya Kinoshita
# Unlimited permission is granted to use, copy, distribute, and/or modify
# this program. There is NO WARRANTY.
if [ -z "$1" ]; then exit 1; fi
YESORNO="$1"; shift
if [ -z "$1" ]; then exit 1; fi
bogofilter -v -B "$@" | fgrep -i " X-Bogosity: ${YESORNO}" | sed -e 's/ X-Bogosity.*//'
-----
--
Tatsuya Kinoshita
More information about the Mew-int
mailing list