info-gnus-english
[Top][All Lists]
Advanced

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

[Solution of sorts] (was: Checking if user-mail-address is in To or CC (


From: Uwe Brauer
Subject: [Solution of sorts] (was: Checking if user-mail-address is in To or CC (to avoid an embarrassing social situation) BCC)
Date: Mon, 10 Feb 2025 22:44:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

> Hi
> Let’s assume I write an email to:  

> (defun check-my-to-field ()
>   "This function will be run before you execute followup. And it warns you if 
> your email address is not 
> in the To field. That warning is a safty message if you had been only on the 
> BCC field!!"
>   (interactive)
>   (unless (string-match user-mail-address (message-fetch-field "To"))
>     (if (y-or-n-p "Warning: Followup? But you are not on the TO field, you 
> FOOL, proceed?")
>       (message "I hope you are sure.")
>       (error
>        (progn
>          (message "Aborted, you are not in the To: field!!!"))))))

> (defadvice gnus-article-followup-with-original (before mychecktofield 
> activate) 
>  "This function will be run before you execute followup. It warns you if
>  your email address is not in the To field. That warning is a safty
>  message if you had been only on the BCC field!!" 
>   (check-my-to-field))



> It does not work in the *summary buffer*.  

Adding   (gnus-summary-select-article-buffer)

Solves the problem somehow:

(defun check-my-to-field ()
  "This function will be run before you execute followup. And it
warns you if your email address is not in the To field. That
warning is a safty message if you had been only on the BCC
field!!"
  (interactive)
  (gnus-summary-select-article-buffer)
  (unless
      (string-match user-mail-address (message-fetch-field "To"))
    (if (y-or-n-p "Warning: Followup? But you are not on the TO field, you 
FOOL, proceed?")
        (message "I hope you are sure.")
      (error
       (progn
         (message "Aborted, you are not in the To: field!!!"))))))



(defadvice gnus-article-followup-with-original (before mychecktofield activate) 
  "This function will be run before you execute followup. It warns you if your 
email address is not in the To field. That
warning is a safty message if you had been only on the BCC field!!"
  (check-my-to-field))

(defadvice gnus-summary-followup-with-original (before mychecktofield activate) 
  "This function will be run before you execute followup. It warns you if your 
email address is not in the To field. That
warning is a safty message if you had been only on the BCC field!!"
  (check-my-to-field))


Uwe Brauer 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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