Re: choices on reading HTML emails

2018-04-10 Thread Chris Green
On Tue, Apr 10, 2018 at 09:10:38AM -0700, Omen Wild wrote:
> Quoting Chris Green  on Tue, Apr 10 09:44:
> >
> > The muttfox script just calls a local or remote firefox it's only
> > necessary because I run mutt via ssh remotely someetimes.  For normal
> > use you can just call firefox directly.
> 
> Can you share this script? I have the same issue, but have been manually
> working around it over SSH.

Here you go, it depends on having somewhere 'out there' on the cloud
to save the message.

#!/bin/bash
#
#
# muttfox: script called by mutt via mailcap to use firefox to view HTML,
# necessary because /usr/bin/firefox exits before firefox has
# actually loaded the HTML file, especially when it's remote
#
# The temporary file to be viewed by Firefox is copied to a dedicated
# user account called 'share' on isbd.uk (Gandi virtual machine). This
# can take a second or two but means that the same code works when my
# laptop is on the home LAN or away from home.
#
# if there's no DISPLAY variable then Firefox can't run, so skip the whole 
thing
#
if [ -n "$DISPLAY" ]
then
#
#
# copy the file to isbd.uk, $i is /tmp/mutt/
#
export RSYNC_RSH="ssh -i /home/chris/.ssh/np_id_rsa"
chmod 644 $1
rsync -a $1 isbd.uk:mutt
#
#
# pass the copy to firefox, runs local or remote firefox according to 
$DISPLAY
#
/usr/bin/firefox http://isbd.uk/mutt/$(basename $1)
fi


-- 
Chris Green


Re: choices on reading HTML emails

2018-04-10 Thread Grant Edwards
On 2018-04-10, Yubin Ruan  wrote:

> Can anyone share some approaches for reading HTML emails.
[...]
> But sometimes I receive some HTML mails which can not be handled
> that well by w3m, so I want to open that html attachment in a
> browser. How can I switch between?

I have my mailcap entry set up so that "viewing" an html message uses
w3m but "printing" an html message opens it in chromium:

  $ fgrep text/html ~/.mailcap 

  text/html; w3m -T text/html -dump; copiousoutput; print = chromiumurl %s;

  $ cat ~/bin/chromiumurl 

  #!/bin/bash
  URL="$1"
  test -f "$URL" && URL="file://$URL"
  expr match "$URL" '.*://.*' >/dev/null || URL="http://$URL";
  exec chromium "$URL"

-- 
Grant Edwards   grant.b.edwardsYow! Am I elected yet?
  at   
  gmail.com



Re: Wide Glyph Problems

2018-04-10 Thread David Woodfall

On Monday 9 April 2018 21:47,
Dave Woodfall  put forth the proposition:

On Monday 9 April 2018 20:18,
Dave Woodfall  put forth the proposition:

On Monday 9 April 2018 14:05,
mut...@eldondev.com  put forth the proposition:

On Mon, Apr 09, 2018 at 05:04:15PM +0100, David Woodfall wrote:

I'm having problems with some messages that use wide glyphs,
especially mail from Ebay (even though I have chosen plain text
mail).


I think that I am experiencing something similar, but in my case
rendering errors generate what appears to be an unexpected linebreak or
similar. This will throw the whole screen off until I do a manual
redraw. Using mutt in gnu screen in urxvt. Not sure if it's related, but
it happens with the same character sets you describe.


Yes, I just tested without screen and it's fine in urxvt and
xfce4-term. Going to move this to the screen bugzilla.


Actually though, in vim + screen it is fine. It just seems to be a
combination of screen + mutt for some reason.

Stumped.


OK. It looks like there's a difference between what mutt is defining
for wide chars than screen.

Here is the screen commit that broke it for mutt:

https://git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v4&id=c10e99789904ac687701fb9bd7d2bf8b8995b166

It just updates the wide glyph table.


Re: choices on reading HTML emails

2018-04-10 Thread Grant Edwards
On 2018-04-10, Yubin Ruan  wrote:
> Hi,
>
> Can anyone share some approaches for reading HTML emails.
> Currenlty I use w3m:
>
> text/html; w3m -I %{charset} -T text/html; copiousoutput;
>
> But sometimes I receive some HTML mails which can not be handled that well by
> w3m, so I want to open that html attachment in a browser. How can I switch
> between?

I have my mailcap entry set up so that "viewing" an html message uses
w3m but "printing" an html message passes it to chromium:

  $ fgrep text/html ~/.mailcap 
  text/html; w3m -T text/html -dump; copiousoutput; print = chromiumurl %s;

  $ cat ~/bin/chromiumurl 
  #!/bin/bash
  URL="$1"
  test -f "$URL" && URL="file://$URL"
  expr match "$URL" '.*://.*' >/dev/null || URL="http://$URL";
  exec chromium "$URL"

-- 
Grant Edwards   grant.b.edwardsYow! Am I elected yet?
  at   
  gmail.com



Re: choices on reading HTML emails

2018-04-10 Thread Jude DaShiell
I wonder, can mutt be used to strip all images and toss them in the 
trash and strip all image attachments and toss them in the trash then 
make remaining text viewable in mutt?  Some of us with this kind of 
capability could save lots of disk space.


On Tue, 10 Apr 2018, Akkana Peck wrote:


Date: Tue, 10 Apr 2018 12:46:08
From: Akkana Peck 
To: mutt-users@mutt.org
Subject: Re: choices on reading HTML emails


On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:


Can anyone share some approaches for reading HTML emails.
Currenlty I use w3m:

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

But sometimes I receive some HTML mails which can not be handled that well by
w3m, so I want to open that html attachment in a browser. How can I switch
between?


Chris Green writes:

I have similar, my .mailcap is:-

text/html; /home/chris/bin/muttfox %s
text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html

So I use lynx to view HTML E-Mail by default and to view in my browser
I hit v[iew-attachment] and then 'm' for view-mailcap to view using my
muttfox script.  The muttfox script just calls a local or remote
firefox it's only necessary because I run mutt via ssh remotely
someetimes.  For normal use you can just call firefox directly.


I have several ways of dealing with different types of HTML,
though it starts with a mailcap like Chris':

text/html; mimehelper 5 firefox 'file://%s'; nametemplate=%s.html
text/html; lynx -term=xterm -dump %s; nametemplate=%s.html; copiousoutput

Mutt will automatically show html messages using lynx, but if I want
to see them in firefox, I use 'v' to see the attachment list, arrow
down to the attachment and hit return. mimehelper is a script that
runs a program then sleeps for 5 seconds, otherwise mutt often
removes the temp file before the browser has had a chance to read it.
I wish I could make mutt less aggressive about removing its temp files.

Then there's the case of multipart/alternative messages where the
text part (which I prefer in alternative_order) is broken; I don't
necessarily want to open the HTML message in a browser, I just want
to reverse alternative_order so I can see the HTML part it lynx.
I have a binding for that which I got from
http://www.archivum.info/comp.mail.mutt/2008-08/2/Re-combined-html-ascii-message-mutt-shows-html-but-not-ascii.html

That still leaves the edge case of HTML mail with attached images.
I don't get those very often, but when I do, mutt can't show the
images. So I wrote a Python script that pulls out the cid:
attachments and saves them, then rewrites the HTML to point to them.
http://shallowsky.com/blog/tech/email/mutt-viewing-html-mail.html

Finally, I have a script that brings up a browser window showing all
the attachments, both HTML and Word docs (converted to HTML), in
different tabs. (I unfortunately have to correspond with a group of
people who insist on communicating by mailing bunches of Word
attachments). So I put that on F5:
macro index  "~/bin/viewmailattachments\n" "View all attachments 
in browser"
macro pager  "~/bin/viewmailattachments\n" "View all attachments 
in browser"
The script is at
https://github.com/akkana/scripts/blob/master/viewmailattachments

That one doesn't handle embedded images; some day I need to combine
viewmailattachments and viewhtmlmail into one script.

   ...Akkana



--



Re: choices on reading HTML emails

2018-04-10 Thread Akkana Peck
> On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:
> > 
> > Can anyone share some approaches for reading HTML emails.
> > Currenlty I use w3m:
> > 
> > text/html; w3m -I %{charset} -T text/html; copiousoutput;
> > 
> > But sometimes I receive some HTML mails which can not be handled that well 
> > by
> > w3m, so I want to open that html attachment in a browser. How can I switch
> > between?

Chris Green writes:
> I have similar, my .mailcap is:-
> 
> text/html; /home/chris/bin/muttfox %s
> text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
> 
> So I use lynx to view HTML E-Mail by default and to view in my browser
> I hit v[iew-attachment] and then 'm' for view-mailcap to view using my
> muttfox script.  The muttfox script just calls a local or remote
> firefox it's only necessary because I run mutt via ssh remotely
> someetimes.  For normal use you can just call firefox directly.

I have several ways of dealing with different types of HTML,
though it starts with a mailcap like Chris':

text/html; mimehelper 5 firefox 'file://%s'; nametemplate=%s.html
text/html; lynx -term=xterm -dump %s; nametemplate=%s.html; copiousoutput

Mutt will automatically show html messages using lynx, but if I want
to see them in firefox, I use 'v' to see the attachment list, arrow
down to the attachment and hit return. mimehelper is a script that
runs a program then sleeps for 5 seconds, otherwise mutt often
removes the temp file before the browser has had a chance to read it.
I wish I could make mutt less aggressive about removing its temp files.

Then there's the case of multipart/alternative messages where the
text part (which I prefer in alternative_order) is broken; I don't
necessarily want to open the HTML message in a browser, I just want
to reverse alternative_order so I can see the HTML part it lynx.
I have a binding for that which I got from
http://www.archivum.info/comp.mail.mutt/2008-08/2/Re-combined-html-ascii-message-mutt-shows-html-but-not-ascii.html

That still leaves the edge case of HTML mail with attached images.
I don't get those very often, but when I do, mutt can't show the
images. So I wrote a Python script that pulls out the cid:
attachments and saves them, then rewrites the HTML to point to them.
http://shallowsky.com/blog/tech/email/mutt-viewing-html-mail.html

Finally, I have a script that brings up a browser window showing all
the attachments, both HTML and Word docs (converted to HTML), in
different tabs. (I unfortunately have to correspond with a group of
people who insist on communicating by mailing bunches of Word
attachments). So I put that on F5:
macro index  "~/bin/viewmailattachments\n" "View all 
attachments in browser"
macro pager  "~/bin/viewmailattachments\n" "View all 
attachments in browser"
The script is at
https://github.com/akkana/scripts/blob/master/viewmailattachments

That one doesn't handle embedded images; some day I need to combine
viewmailattachments and viewhtmlmail into one script.

...Akkana


Re: choices on reading HTML emails

2018-04-10 Thread Omen Wild
Quoting Chris Green  on Tue, Apr 10 09:44:
>
> The muttfox script just calls a local or remote firefox it's only
> necessary because I run mutt via ssh remotely someetimes.  For normal
> use you can just call firefox directly.

Can you share this script? I have the same issue, but have been manually
working around it over SSH.

-- 
If everyone were happy all the time, musicians would be out of a job.


smime.p7s
Description: S/MIME cryptographic signature


Re: choices on reading HTML emails

2018-04-10 Thread Jude DaShiell
Interesting, anything different in the headings of webmail not handled 
well by w3m as opposed to messages w3m handles well?  If so, maybe 
isolating that difference and writing an additional line for the 
.mailcap file will help.


On Tue, 10 Apr 2018, Yubin Ruan wrote:


Date: Tue, 10 Apr 2018 03:57:53
From: Yubin Ruan 
To: mutt-users@mutt.org
Subject: choices on reading HTML emails

Hi,

Can anyone share some approaches for reading HTML emails.
Currenlty I use w3m:

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

But sometimes I receive some HTML mails which can not be handled that well by
w3m, so I want to open that html attachment in a browser. How can I switch
between?

Yubin



--



Re: choices on reading HTML emails

2018-04-10 Thread Chris Green
On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:
> 
> Can anyone share some approaches for reading HTML emails.
> Currenlty I use w3m:
> 
> text/html; w3m -I %{charset} -T text/html; copiousoutput;
> 
> But sometimes I receive some HTML mails which can not be handled that well by
> w3m, so I want to open that html attachment in a browser. How can I switch
> between?
> 
I have similar, my .mailcap is:-

text/html; /home/chris/bin/muttfox %s
text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html

So I use lynx to view HTML E-Mail by default and to view in my browser
I hit v[iew-attachment] and then 'm' for view-mailcap to view using my
muttfox script.  The muttfox script just calls a local or remote
firefox it's only necessary because I run mutt via ssh remotely
someetimes.  For normal use you can just call firefox directly.

-- 
Chris Green


Re: choices on reading HTML emails

2018-04-10 Thread Arkadiusz Drabczyk
On 2018-04-10, Brian Salter-Duke  wrote:
> On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:
>> Hi,
>> 
>> Can anyone share some approaches for reading HTML emails.
>> Currenlty I use w3m:
>> 
>> text/html; w3m -I %{charset} -T text/html; copiousoutput;
>> 
>> But sometimes I receive some HTML mails which can not be handled that well by
>> w3m, so I want to open that html attachment in a browser. How can I switch
>> between?
>> 
>> Yubin
>
> I use
>
> text/html; /home/brian/bin/see_html %s

Notice that you don't have to use full paths in .mailcap.  As mutt
passes mailcap commands to sh you can use one of these 2 to make your
.mailcap more portable:

text/html; $HOME/bin/see_html %s
text/html; ~/bin/see_html %s

And if see_html is in your $PATH:

text/html; see_html %s

Personally, I use
https://raw.githubusercontent.com/tampakrap/bin/master/viewhtmlmail.py.
The good thing about it is that it can also display images embedded in
html messages.  I have this in my .muttrc:

macro  pager"~/bin/viewhtmlmail.py\n" "ViewHTML in 
browser"
-- 
Arkadiusz Drabczyk 



Re: choices on reading HTML emails

2018-04-10 Thread Matthias Apitz
El día martes, abril 10, 2018 a las 03:57:53p. m. +0800, Yubin Ruan escribió:

> Hi,
> 
> Can anyone share some approaches for reading HTML emails.

I do use what you can see in my header line 'X-message-flag:'

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub


signature.asc
Description: PGP signature


Re: choices on reading HTML emails

2018-04-10 Thread David Woodfall

On Tuesday 10 April 2018 15:57,
Yubin Ruan  put forth the proposition:

Hi,

Can anyone share some approaches for reading HTML emails.
Currenlty I use w3m:

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

But sometimes I receive some HTML mails which can not be handled that well by
w3m, so I want to open that html attachment in a browser. How can I switch
between?

Yubin


What I did was make a shell script to save the mail and open it in
elinks when autoview didn't autoopen it for some reason. You can
easily change elinks to another browser:

#!/bin/sh

TMPFILE="/tmp/mutt-elinks.html"
cat /dev/stdin > "$TMPFILE"
sed -ri "s%^(Date:|From:|To:|Cc:|Subject:|X-Mailer:)(.*)%\1\2\%g" 
"$TMPFILE"
elinks -force-html "$TMPFILE"
rm -f "$TMPFILE"

And the macro:

macro pager,index,attach Z "|~/.mutt/elinks"

The sed line is just to add line breaks to the headers.


choices on reading HTML emails

2018-04-10 Thread Yubin Ruan
Hi,

Can anyone share some approaches for reading HTML emails.
Currenlty I use w3m:

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

But sometimes I receive some HTML mails which can not be handled that well by
w3m, so I want to open that html attachment in a browser. How can I switch
between?

Yubin