displaying messages in a web browser

Showing 1-3 of 3 messages
displaying messages in a web browser SF 2/26/13 7:47 PM
Sometimes I get really nasty HTML emails that neither w3m, lynx, or elinks will convert into something useful. This little action helps in these cases. Comments on how to turn this a pure elisp solution are welcome :)

(defun mu4e-action-view-in-browser (msg)
  (let* ((q mu4e-html2text-command)
     )
    (setq mu4e-html2text-command "mu4e-showinbrowser.sh")
    (mu4e-message-body-text msg)
    (setq mu4e-html2text-command q)
    ))

(add-to-list 'mu4e-headers-actions
         '("in browser" . mu4e-action-view-in-browser) t)
(add-to-list 'mu4e-view-actions
         '("in browser" . mu4e-action-view-in-browser) t)


And here is mu4e-showinbrowser.sh:

#!/bin/bash
_fname=$(mktemp mu4etowww.XXXXXXXXXXXXXXXXX)
cat - > ${_fname}
/usr/bin/firefox --new-window ${_fname}

Re: displaying messages in a web browser SF 3/3/13 6:40 AM
Since many HTML messages don't have an enclosing html tag, this version of mu4e-showinbrowser.sh works better:

#!/bin/bash
_fname=$(mktemp)
echo "<html>" > ${_fname}
cat - >> ${_fname}
echo "</html>" >> ${_fname}
/usr/bin/firefox --new-window ${_fname}
Re: displaying messages in a web browser SF 3/17/13 5:08 PM
Note that the latest version of mu has an action build in that does this without the need of an external bash script. The action is called mu4e-action-view-in-browser, so just add it to your header and view action list.