(defun auto-reject-message () "Forward to the current message back to its originator. Prompt for a rejection message file to include." (interactive) (call-interactively 'gnus-summary-show-article) (let ((auto-rejection-file (completing-read "Rejection File: " (mapcar 'list (directory-files auto-rejection-dir nil (regexp-quote auto-rejection-file-prefix))) nil t auto-rejection-file-prefix)) (auto-rejected-user (save-excursion (set-buffer gnus-article-buffer) (or (message-fetch-field "Reply-To") (message-fetch-field "From"))))) (if (= (length auto-rejection-file) 0) (setq auto-rejection-file auto-default-rejection-file)) (if (not auto-rejected-user) (error "Error in message structure: no Reply-To or From lines.")) (gnus-summary-mail-forward t) (goto-char (point-min)) (search-forward mail-header-separator nil 'limit nil) (insert "\n") (insert-file-contents (concat auto-rejection-dir auto-rejection-file)) (goto-char (point-min)) (message-goto-to) (insert auto-rejected-user) (message-send-and-exit)))