I want to reply messages with a "Disposition-Notification-To" field in
the header automatically.
Here is a working solution, is there a better soloution?

(add-hook 'gnus-startup-hook
          '(lambda ()
             (setq gnus-visible-headers
                   (concat "^Disposition-Notification-To:\\|"
                           gnus-visible-headers))))

(eval-after-load "gnus-sum"
  '(add-hook 'gnus-mark-article-hook 'my-check-notification))

(defun my-check-notification ()
  (if (gnus-summary-article-unread-p (gnus-summary-article-number))
      (add-hook 'gnus-article-prepare-hook 'my-reply-notification)
    (remove-hook 'gnus-article-prepare-hook 'my-reply-notification)))

(defun my-reply-notification ()
  (save-excursion
    (save-restriction
      (message-narrow-to-headers)
      (if (and (mail-fetch-field "disposition-notification-to")
               (yes-or-no-p "Really send the dispositon notification?"))
          (progn (gnus-summary-reply)
                 (insert "Got it, thanks.")
                 (message-send-and-exit))))))

_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english

Reply via email to