Gnus development mailing list
 help / color / mirror / Atom feed
* spam-split of spam.el with bsfilter
@ 2020-09-21 16:15 Hirotaka Honda
  2020-09-22  1:55 ` 黃炳熙
  2021-04-10 10:50 ` Hirotaka Honda
  0 siblings, 2 replies; 18+ messages in thread
From: Hirotaka Honda @ 2020-09-21 16:15 UTC (permalink / raw)
  To: ding

Dear all

I have been using nnmail-split-fancy as nnmail-split-methods with spam-split function on Emacs 24.5.1. It worked very well.

After I changed my computer, installed Emacs 27.1 with Gnus v5.13, and compiled bogofilter, I could not make bogofilter work for spam-split (somehow, I could get values by S t in summery buffer), however long time I examined.

Luckily I found that bsfilter seems supported by spam.el.
bsfilter is able to handle spams in Japanese.

Environment
Previous (x86_64-apple-darwin15.3.0, NS apple-appkit-1404.34) of 2016-02-28 on my MacOS
Current (build 1, x86_64-apple-darwin19.6.0, Carbon Version 162 AppKit 1894.6) of 2020-09-06

Problem 1
spam-split function seems sending mail text to bsfilter. But even when it replies "X-Spam-Flag: Yes", it will not send it to the folder specified by the value spam-split-group.

I made a script, bsfilter-test, which confirmed the problem.

Probelem 2
When I try spam-generic-score at summery buffer by keys S t, I always get the message "Spamicity score 0" even if the message tested was evaluated as spam by bogofilter on the command line of shell.

I would be grateful if someone gives me any clues or hints to solve the problems.

;;;; init file settings relating to spam.el is as the following:
(require 'spam)
(spam-initialize)

(setq spam-junk-mailgroups '("mail.spam"))
(setq gnus-spam-process-destinations '(("nnml:.*" "nnml:mail.spam"))
	  gnus-ham-process-destinations '(("nnml:mail.spam" "nnml:mail.misc")))
(setq spam-split-group '("mail.spam")) ;; nnml:xx wrong  9.17.2 Filtering Incoming Mail
(setq spam-mark-ham-unread-before-move-from-spam-group t) ;; Manual

(setq spam-bogofilter-program "/opt/local/bin/bogofilter")
(setq spam-bogofilter-database-directory "/Users/hirotaka/.bogofilter") ;; right

(setq spam-bsfilter-program "/Users/hirotaka/Applications/bin/bsfilter-test")
(setq spam-use-bsfilter t)
(setq spam-bsfilter-database-directory "/Users/hirotaka/.bsfilter")

(setq gnus-install-group-spam-parameters nil) ;; necessary?

(setq gnus-spam-process-newsgroups
      '(("nnml:.*" ((spam spam-use-bsfilter)
			(ham spam-use-bsfilter)))))

(setq gnus-parameters
	  '( ("nnml:mail\\.spam"
 		  (display . all)
		  (spam-contents gnus-group-spam-classification-spam)
		  (spam-process ((spam spam-use-bsfilter) (ham spam-use-bsfilter)))
		  (spam-process-destination . "nnml:mail.spam")
		  (ham-process-destination . "nnml:mail.misc")
		  (ham-marks (gnus-del-mark gnus-read-mark gnus-ticked-mark gnus-killed-mark))
		  (spam-bsfilter-database-directory . "/Users/hirotaka/.bsfilter"))
		 ("nnml:mail\\.misc"
 		  (display . all)
		  (spam-contents gnus-group-spam-classification-ham)
		  (spam-process ((spam spam-use-bsfilter) (ham spam-use-bsfilter)))
		  (spam-process-destination . "nnml:mail.spam")
		  (ham-process-destination . "nnml:mail.misc")
		  (ham-marks (gnus-del-mark gnus-read-mark gnus-ticked-mark gnus-killed-mark))
		  (spam-marks (gnus-spam-mark))
		  (spam-bsfilter-database-directory . "/Users/hirotaka/.bsfilter"))
		 ("nnml:mail\\.hirotaka"
 		  (display . all)
		  (spam-contents gnus-group-spam-classification-ham)
		  (spam-process ((spam spam-use-bsfilter) (ham spam-use-bsfilter)))
		  (spam-process-destination . "nnml:mail.spam")
		  (ham-process-destination . "nnml:mail.misc")
		  (ham-marks (gnus-del-mark gnus-read-mark gnus-ticked-mark gnus-killed-mark))
		  (spam-marks (gnus-spam-mark))
		  (spam-bsfilter-database-directory . "/Users/hirotaka/.bsfilter"))))

;;;; bsfilter-test is as the following:
#!/opt/local/bin/bash
LOG=$HOME/tmp/bsfilter-spamel-log
FARGV=("$@")
FARGC=("$#")
TARGV=()
for ((i=0; i< $FARGC ;i++)){
	TARGV[i]=`echo ${FARGV[i]} | nkf -w`
	echo $i ${FARGV[i]} ":" ${TARGV[i]} >> $LOG
	}
nkf -w | bsfilter ${TARGV[0]} ${TARGV[1]} ${TARGV[2]} ${TARGV[3]} ${TARGV[4]} ${TARGV[5]} ${TARGV[6]} ${TARGV[7]} ${TARGV[8]} ${TARGV[9]} ${TARGV[10]} ${TARGV[11]} ${TARGV[12]} | tee -a $LOG
# nkf -w: nkf is a tool to convert coding. -w option means output UTF-8

-- 
Hirotaka Honda
Honda Law Office
ParkAxis ShibuyaSakuragaoka South 801
8-11  Sakuragaokacho, Shibuya-Ku
Tokyo 150-0031 Japan
Tel +81 3 3463 6602 Fax +81 3 3463 6608
http://www.hondalaw.com


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-06-01 23:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 16:15 spam-split of spam.el with bsfilter Hirotaka Honda
2020-09-22  1:55 ` 黃炳熙
2020-09-22  2:09   ` Emanuel Berg
2020-09-23  0:48     ` 黃炳熙
2020-09-23  1:01       ` Emanuel Berg
2020-09-23  2:30         ` 黃炳熙
2021-04-10 10:50 ` Hirotaka Honda
2021-04-10 13:30   ` Emanuel Berg
2021-04-11 11:10     ` Hirotaka Honda
2021-04-11 11:16       ` Emanuel Berg
2021-05-27 13:48       ` Mail source failed, wrong-type-argument integer-or-marker-p nil Hirotaka Honda
2021-05-27 15:59         ` Eric Abrahamsen
2021-05-27 16:49           ` Hirotaka Honda
2021-05-27 16:53             ` Eric Abrahamsen
2021-05-27 21:30               ` Hirotaka Honda
2021-05-28 17:29                 ` Eric Abrahamsen
2021-05-28  2:40           ` Pankaj Jangid
2021-05-28 23:05             ` Andy Moreton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).