Re: Viewing HTML in a real browser

2015-01-01 Thread Nuno J. Silva (aka njsg)
On 2013-12-14, Chris Down ch...@chrisdown.name wrote:

 Occasionally I get complex HTML e-mails that don't quite work in w3m
 (which is what I have in my mailcap to view text/html). In these
 instances, I would like to be able to somehow view these in my browser.
 Right now my procedure is this:

 - Go to attach
 - Save the html part as /tmp/foo.html
 - Open my browser
 - Open file:///tmp/foo.html

 Is there some way I can automate this better, say, by being able to hit
 a key and have the HTML part of the message open in the browser?

 My browser is Chromium, but I think any generic solution should be
 adaptable.

 Thanks.

While I was reading this thread, I remembered that, in the past, it was
more frequent to see email messages as files under Microsoft Windows.

I am not sure if it is exactly the same thing, but there is MHTML and
Wikipedia says The content of an MHTML file is encoded as if it were an
HTML e-mail message, using the MIME type multipart/related.

While vanilla Firefox does not support MHTML out of the box, I tried
https://addons.mozilla.org/en-US/firefox/addon/unmht/ which is indeed
able to render email messages with embedded pictures (you may need to
add the .mht extension to the file, I'm not sure about this).

I don't know if there is something similar for Google Chrome, but I
thought this could help, at least, Firefox users.

-- 
Nuno Silva (aka njsg)
Helsinki, Finland



Re: Viewing HTML in a real browser

2013-12-15 Thread Christian Ebert
* Chris Down on Sunday, December 15, 2013 at 12:00:45 +0800
 On 2013-12-14 14:08:35 +, Christian Ebert wrote:
 Shameless plug: https://bitbucket.org/blacktrash/muttils has a
 viewhtmlmsg script which can be bound to a key.
 
 This looks pretty nice, thanks. Some of the checks it does seem quite
 useful. Perhaps some of it could be mitigated in-browser instead by
 using switches to disable unsafe content.

You can just use it without the --safe option?

-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


Re: Viewing HTML in a real browser

2013-12-15 Thread Chris Down
On 2013-12-15 12:32:40 +, Christian Ebert wrote:
 You can just use it without the --safe option?

Right -- my point was about doing it without an external script. For now
catting it to a file and opening it in chromium is sufficient, but it
has some annoying caveats (charset, unsafe stuff)... thankfully I do
this infrequently (and specifically) enough that that isn't really an
issue though.

Thanks, though. :-)


pgp8AsdBy1ZWP.pgp
Description: PGP signature


Re: Viewing HTML in a real browser

2013-12-14 Thread Peter Davis
On Sat, Dec 14, 2013 at 08:27:09PM +0800, Chris Down wrote:
 Occasionally I get complex HTML e-mails that don't quite work in w3m
 (which is what I have in my mailcap to view text/html). In these
 instances, I would like to be able to somehow view these in my browser.
 Right now my procedure is this:
 
 - Go to attach
 - Save the html part as /tmp/foo.html
 - Open my browser
 - Open file:///tmp/foo.html
 
 Is there some way I can automate this better, say, by being able to hit
 a key and have the HTML part of the message open in the browser?
 
 My browser is Chromium, but I think any generic solution should be
 adaptable.

If you Google pipe to browser, you'll find various tools that will
do this for you. I use one on the Mac called simply browser, but
there are others. Then in mutt you could simply view the list of parts
('v' command) and pipe the html ('|' command) to one of those.

I think these mostly just do what you're doing ... save the html to a
temp file and open that in the default browser.




Re: Viewing HTML in a real browser

2013-12-14 Thread Chris Down
On 2013-12-14 07:43:31 -0500, Peter Davis wrote:
 If you Google pipe to browser, you'll find various tools that will
 do this for you. I use one on the Mac called simply browser, but
 there are others. Then in mutt you could simply view the list of parts
 ('v' command) and pipe the html ('|' command) to one of those.
 
 I think these mostly just do what you're doing ... save the html to a
 temp file and open that in the default browser.

Well, this is the macro I currently use:

macro attach B pipe-messagecat  /tmp/mutt.html; chromium 
/tmp/mutt.htmlenter

That obviously has a race condition, but in practise it's not an issue.

The one thing that annoys me is that I have to go into the attach menu
to select the HTML part to do this. If I pipe from the pager, I might
end up piping the text/plain part (which, in one particular case, says
You need HTML to view this message -- what the?!).


pgpHVXpmRUAqQ.pgp
Description: PGP signature


Re: Viewing HTML in a real browser

2013-12-14 Thread Christian Ebert
* Chris Down on Saturday, December 14, 2013 at 20:27:09 +0800
 Occasionally I get complex HTML e-mails that don't quite work in w3m
 (which is what I have in my mailcap to view text/html). In these
 instances, I would like to be able to somehow view these in my browser.
 Right now my procedure is this:
 
 - Go to attach
 - Save the html part as /tmp/foo.html
 - Open my browser
 - Open file:///tmp/foo.html
 
 Is there some way I can automate this better, say, by being able to hit
 a key and have the HTML part of the message open in the browser?

Shameless plug: https://bitbucket.org/blacktrash/muttils has a
viewhtmlmsg script which can be bound to a key.

-- 
_BAUSTELLEN_ lesen! --- http://www.blacktrash.org/baustellen


Re: Viewing HTML in a real browser

2013-12-14 Thread Will Fiveash
On Sat, Dec 14, 2013 at 02:08:35PM +, Christian Ebert wrote:
* Chris Down on Saturday, December 14, 2013 at 20:27:09 +0800
 Occasionally I get complex HTML e-mails that don't quite work in w3m
 (which is what I have in my mailcap to view text/html). In these
 instances, I would like to be able to somehow view these in my browser.
 Right now my procedure is this:
 
 - Go to attach
 - Save the html part as /tmp/foo.html
 - Open my browser
 - Open file:///tmp/foo.html
 
 Is there some way I can automate this better, say, by being able to hit
 a key and have the HTML part of the message open in the browser?

Shameless plug: https://bitbucket.org/blacktrash/muttils has a
viewhtmlmsg script which can be bound to a key.

I use this regularly and find it very useful, thanks.

-- 
Will Fiveash


Re: Viewing HTML in a real browser

2013-12-14 Thread Omen Wild
Quoting Chris Down ch...@chrisdown.name on Sat, Dec 14 20:27:

 Occasionally I get complex HTML e-mails that don't quite work in w3m
 (which is what I have in my mailcap to view text/html). In these
 instances, I would like to be able to somehow view these in my browser.
 Right now my procedure is this:

muttils http://www.blacktrash.org/hg/muttils/ has a viewhtmlmsg
program designed exactly for this.

macro index,pager V |viewhtmlmsg\n View HTML msg in browser

-- 
Afternoon, n.: That part of the day we spend
worrying about how we wasted the morning.


smime.p7s
Description: S/MIME cryptographic signature


Re: Viewing HTML in a real browser

2013-12-14 Thread Tim Gray

On Dec 14, 2013 at 08:27 PM +0800, Chris Down wrote:

My browser is Chromium, but I think any generic solution should be
adaptable.


I use Christian's script for complex html messages, particularly ones 
that have images attached in the email.  However, it's a bit slower 
sometimes then just opening up the html attachment via mailcap.  
I have two entries in my mailcap, one for viewing in Safari (on OS X) 
and one for viewing in mutt via w3m and the copious output setting.  
view-attach shows the w3m version in the pager and view-mailcap saves 
the html in a temp directory and opens it in Safari, using Eric 
Gebhart's view_attachment script.


text/html; /Users/me/bin/view_attachment %s html Safari ;
text/html; /usr/local/bin/w3m -dump %s; copiousoutput; nametemplate=%s.html


Re: Viewing HTML in a real browser

2013-12-14 Thread Chris Down
On 2013-12-14 18:03:57 -0500, Tim Gray wrote:
 I use Christian's script for complex html messages, particularly ones that
 have images attached in the email.  However, it's a bit slower sometimes
 then just opening up the html attachment via mailcap.

Thankfully I only plan to do this in instances where `w3m -dump` doesn't
suffice. :-)

 I have two entries in my mailcap, one for viewing in Safari (on OS X)
 and one for viewing in mutt via w3m and the copious output setting.
 view-attach shows the w3m version in the pager and view-mailcap saves
 the html in a temp directory and opens it in Safari, using Eric
 Gebhart's view_attachment script.
 
 text/html; /Users/me/bin/view_attachment %s html Safari ;
 text/html; /usr/local/bin/w3m -dump %s; copiousoutput; nametemplate=%s.html

I believe since w3m can take input from stdin you don't need to use
nametemplate, and you can do something like the following instead:

text/html; w3m -I %{charset} -T text/html -dump; copiousoutput


pgpqF7OjZ_HM3.pgp
Description: PGP signature


Re: Viewing HTML in a real browser

2013-12-14 Thread Chris Down
On 2013-12-14 14:08:35 +, Christian Ebert wrote:
 Shameless plug: https://bitbucket.org/blacktrash/muttils has a
 viewhtmlmsg script which can be bound to a key.

This looks pretty nice, thanks. Some of the checks it does seem quite
useful. Perhaps some of it could be mitigated in-browser instead by
using switches to disable unsafe content.


pgpoYREwYDuW1.pgp
Description: PGP signature