[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: forward-mail without editing with single command
From: |
Jochen Küpper |
Subject: |
Re: forward-mail without editing with single command |
Date: |
Tue, 29 Jun 2004 17:39:31 -0000 |
User-agent: |
No Gnus v0.3 |
On Mon, 07 Jun 2004 09:22:33 -0400 Linh Dang wrote:
Linh> Hi would like to forward a mail in *Summary* buffer without editing.
Linh> the destination address is pre-defined. this is what i came up with:
(defvar jk/spam-report-address "spam@my.domain.tld"
"Email-address to report ill-classified spam.")
(defvar jk/ham-report-address "nospam@my.domain.tld"
"Email-address to report ill-classified ham.")
(defvar jk/spam-target "nnimap+FHI:spam/misc"
"Group to move reported spam too.")
(defun jk/ham-spam-report (to-address)
"Digest and forward all articles in this series to the specified address."
(let
((gnus-uu-digest-headers nil)
(gnus-uu-save-in-digest t)
(file (mm-make-temp-file (nnheader-concat gnus-uu-tmp-dir
"spam-report")))
(message-forward-as-mime t)
(mail-parse-charset gnus-newsgroup-charset)
(mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
gnus-uu-digest-buffer subject from)
(let ((gnus-article-reply (gnus-summary-work-articles nil)))
(gnus-setup-message 'forward
(setq gnus-uu-digest-from-subject nil)
(setq gnus-uu-digest-buffer
(gnus-get-buffer-create " *gnus spam-report*"))
(gnus-uu-decode-save nil file)
(switch-to-buffer gnus-uu-digest-buffer)
(let ((message-forward-decoded-p t))
(message-forward nil t))))
(setq gnus-uu-digest-from-subject nil)
;; Ok, finish mail
;; Subject:
(goto-char (point-min))
(when (re-search-forward "^Subject: ")
(delete-region (point) (point-at-eol))
(insert "ham/spam report"))
;; From: (Heinz only accepts reports from internal address)
(goto-char (point-min))
(when (re-search-forward "^From:")
(delete-region (point) (point-at-eol))
(insert " jochen@my.domain.tld"))
;; Reply-To: (Heinz only accepts reports from internal address)
(goto-char (point-min))
(when (re-search-forward "^Reply-To:" (point-max) t)
(delete-region (point) (point-at-eol))
(insert " jochen@my.domain.tld"))
;; To:
(goto-char (point-min))
(when (re-search-forward "^To:")
(delete-region (point) (point-at-eol))
(insert " " to-address))
;; Gcc
(goto-char (point-min))
(when (re-search-forward "^Gcc:" (point-max) t)
(delete-region (point-at-bol) (point-at-eol))
(insert " nnimap+FHI:sent/" (format-time-string "%Y/%m")
" nnimap+FHI:spam/reported"))
;; remove signature
(when (message-goto-signature)
(delete-region (- (point) 4) (point-max)))
;; and send
(message-send-and-exit)))
(defun jk/ham-report ()
"Digest and forward all articles in this series to nospam@my.domain.tld."
(interactive)
(jk/ham-spam-report jk/ham-report-address))
(defun jk/spam-report ()
"Digest and forward all articles in this series to spam@my.domain.tld.
In addition move the marked articles to a different group (specified in
`jk/spam-target')."
(interactive)
(gnus-summary-save-process-mark)
(jk/ham-spam-report jk/spam-report-address)
(gnus-summary-yank-process-mark)
(gnus-summary-move-article nil jk/spam-target))
Greetings,
Jochen
--
Einigkeit und Recht und Freiheit http://www.Jochen-Kuepper.de
Liberté, Égalité, Fraternité GnuPG key: CC1B0B4D
(Part 3 you find in my messages before fall 2003.)
pgpyVXBuq0Pwo.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: forward-mail without editing with single command,
Jochen Küpper <=