[mew-int 01077] Re: viruses
Tatsuya Kinoshita
tats at example.com
Mon Sep 9 21:13:50 JST 2002
On September 5, 2002, [mew-int 01075],
Francesco Scaglioni <fgs at example.com> wrote:
> I show my ignorance here with what I fear may be a stupid question --
> I am using mew direct to collect ( from pop3 ) and send ( via smtp )
> my mail. I do not use any other local mail queue or box. How can I
> scan incoming mail for viruses?
I have implemented an interface for Mew + SpamAssassin
(http://spamassassin.org/).
----
;;; A sample ~/.mew.el for Mew + SpamAssassin
;; This file is written by Tatsuya Kinoshita. Copyright is disclaimed.
(setq mew-scan-form-mark-spam nil) ;; If non-nil, the mark specified by 'mew-mark-spam' is automatically put on spam messages.
(setq mew-mark-spam mew-mark-delete)
(setq mew-prog-spamc "spamc") ;; in SpamAssassin
(defadvice mew-scan-form-mark (after mark-spam activate)
(let (file)
(if (and mew-scan-form-mark-spam
(not (string= ad-return-value (char-to-string mew-mark-spam)))
(mew-which-exec mew-prog-spamc)
(setq file (mew-expand-folder (MEW-FLD) (MEW-NUM)))
(file-exists-p file)
(> (call-process mew-prog-spamc file nil nil "-c")
0))
(setq ad-return-value (char-to-string mew-mark-spam)))))
(defun mew-summary-mark-spam (&optional arg)
"Put the mark specified by 'mew-mark-spam' on spam messages.
If called with '\\[universal-argument]', process in the region."
(interactive "P")
(mew-decode-syntax-delete)
(if arg
(let ((begend (mew-summary-get-region)))
(mew-summary-mark-spam-region (car begend) (cdr begend)))
(mew-summary-mark-spam-region (point-min) (point-max))))
(defun mew-summary-mark-spam-region (beg end)
"Put the mark specified by 'mew-mark-spam' on spam messages between
BEG and END."
(interactive "r")
(if (not (mew-which-exec mew-prog-spamc))
(message "'%s' not found!" mew-prog-spamc)
(let ((regex (mew-mark-regex ? )) ;; not marked
(mark mew-mark-spam)
fld msg file alist)
(message "Marking spam messages...")
(save-excursion
(goto-char beg)
(while (re-search-forward regex end t)
(setq fld (mew-summary-folder-name))
(setq msg (mew-summary-message-number))
(setq file (mew-expand-folder fld msg))
(when (and (file-exists-p file)
(> (call-process mew-prog-spamc file nil nil "-c")
0))
(mew-mark-put-mark mark 'no-msg)
(when (mew-virtual-p)
(mew-mark-alist-set alist fld msg)))
(forward-line)) ;; make search faster
(set-buffer-modified-p nil))
(mew-summary-mark-in-physical-alist alist mark)
(message "Marking spam messages...done"))))
----
In SpamAssassin 2.41, `spamc -c' has a bug (return 0 always).
A patch is available at:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/spamassassin/spamassassin/spamd/spamd.raw.diff?r1=1.121.2.12&r2=1.121.2.13&diff_format=u
--
Tatsuya Kinoshita
More information about the Mew-int
mailing list