Function: mh-spamassassin-allowlist
mh-spamassassin-allowlist is an autoloaded and byte-compiled function
defined in mh-junk.el.gz.
Signature
(mh-spamassassin-allowlist MSG)
Documentation
Allowlist MSG with SpamAssassin.
The M-x mh-junk-allowlist (mh-junk-allowlist) command adds a "whitelist_from" rule to
the "~/.spamassassin/user_prefs" file. If the "sa-learn" command
is available, the message is also recategorized as ham.
See mh-spamassassin-blocklist for more information.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-junk.el.gz
;;;###mh-autoload
(defun mh-spamassassin-allowlist (msg)
"Allowlist MSG with SpamAssassin.
The \\[mh-junk-allowlist] command adds a \"whitelist_from\" rule to
the \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command
is available, the message is also recategorized as ham.
See `mh-spamassassin-blocklist' for more information."
(unless mh-spamassassin-executable
(error "Unable to find the spamassassin executable"))
(let ((msg-file (mh-msg-filename msg mh-current-folder))
(show-buffer (get-buffer mh-show-buffer))
from)
(with-current-buffer (get-buffer-create mh-temp-buffer)
(erase-buffer)
(message "Removing spamassassin markup from message %d..." msg)
(call-process mh-spamassassin-executable msg-file t nil
"--remove-markup")
(if show-buffer
(kill-buffer show-buffer))
(write-file msg-file)
(when mh-sa-learn-executable
(message "Recategorizing message %d as ham with sa-learn..." msg)
(mh-truncate-log-buffer)
;; Put call-process output in log buffer if we are saving it
;; (this happens if mh-junk-background is t).
(with-current-buffer mh-log-buffer
(call-process mh-sa-learn-executable msg-file mh-junk-background nil
"--ham" "--local" "--no-sync")))
(message "Allowlisting sender of message %d..." msg)
(setq from
(car (mail-header-parse-address (mh-get-header-field "From:"))))
(kill-buffer nil)
(if (or (null from) (equal from ""))
(message "Allowlisting sender of message %d...%s"
msg "not done (cannot identify sender)")
(mh-spamassassin-add-rule "whitelist_from" from)
(message "Allowlisting sender of message %d...done" msg)))))