[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keybinding mystery

From: Reiner Steib
Subject: Re: keybinding mystery
Date: Sat, 06 Oct 2007 14:16:43 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

On Fri, Oct 05 2007, Michaël Cadilhac wrote:

> please, if you use a spam mail address, 

Which should be something like "@invalid.invalid" instead of

> use a proper mail header to ask people not to include this address
> when replying (e.g., setting the Mail-Followup-To header).

Here's some code to warn when composing/sending mail to bogus
addresses.  I don't use it myself, but if it works, we could include
it in Gnus (message.el). 

--8<---------------cut here---------------start------------->8---
(defvar rs-message-spamtrap-regexp "noreply\\|nospam\\|invalid")
(defun rs-message-check-spamtrap ()
  "Warn before composing or sending a mail to an invalid address."
  (let ((to (save-restriction
              (message-fetch-field "To"))))
    (when (and (stringp to)
               (setq to (cadr (gnus-extract-address-components to)))
               (or (not
                     (concat "\\(" message-valid-fqdn-regexp "\\)\\'") to))
                   (string-match rs-message-spamtrap-regexp to)))
      (unless (y-or-n-p
               (format "Warning: Address `%s' might be bogus.  Continue? " to))
        (error "Bogus address.")))))

;; Check before composing:
(add-hook 'message-setup-hook 'rs-message-check-spamtrap)
;; Check before sending:
(add-hook 'message-send-mail-hook 'rs-message-check-spamtrap)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]