help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: html mail filter in gnus


From: D . Goel
Subject: Re: html mail filter in gnus
Date: 18 Sep 2002 16:07:32 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

> Hi,
> 
> I'm getting html mail quite often now and it's getting annoying.
> Does anyone has a gnus filter to filter out the html tags and
> leave the plain text behind?


this shows you the lynxed mail.. this got into my .gnus from an
earlier post in g.e.gnus --->


;; function to call to handle text/html attachments
(defun my:gnus-html2text (handle)
  (let (text)
    (with-temp-buffer
      (mm-insert-part handle)
      (save-window-excursion
        (my:html2text-region (point-min) (point-max))
        (setq text (buffer-string))))
    (mm-insert-inline handle text)))

(defun my:html2text-region (min max)
  "Replace the HTML region from MIN to MAX with lynx --dump."
  (interactive "r")
  (let ((file "~/tmp/email.html"))
    (unwind-protect
        (progn
          (write-region min max file)
          (delete-region min max)
          (insert (shell-command-to-string
                   (concat "lynx "
                           "lynx -dump "
                           (shell-quote-argument
                            (expand-file-name file))))))
      ;;(delete-file file)
      )))



(And of course, after that, to see the actual html mail in lynx
itself, you can always type "lynx ~/tmp/email.html" on a term once
gnus has put it there.. in fact

alias browseemail='lynx ~/tmp/email.html'
or
alias browseemail='w3m ~/tmp/email.html'
)



reply via email to

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