Subject: attaching html file

From: [email-masked] (Jungshik Shin)
Date: 24 Sep 1996 20:05:39 -0400

Some mail/news  programs including Pine(with an appropriate entry in
mailcap)  can be configured to launch a web browser to display
text/html. My ~/.mailcap contains following line, which works
with most mail client/news reader endorsing mailcap(e.g. Pine, Tin,Elm)

text/html; xterm -e lynxpipe %s

where lynxpipe is a shell script shown below.

--------------
#!/bin/sh
trap 'rm -f /tmp/$$.*; exit 1' 1 2 15
IN=$1
test  $IN || { IN=/tmp/$$.stdin ;cat >$IN; }
cp $IN $IN.html
lynx  $IN.html
/bin/rm /tmp/$IN.html
/bin/rm /tmp/$$*
-------------

  Netscape-Mail is also able to display text/html in mail message 
as it should be the case because it's a web browser. 

  Problem with Pine is that there's no way to attach HTML file
with Content-Type header text/html. Pine blindly put 'text/plain'
in "Content-Type: " whether it's html or really plain text.
I suspect it also puts 'text/plain' instead of even if it's a 
Postscript file. To solve this problem, I suggest a couple of options
be added to Pine configuration.  They are 

'Allow manual Content-Type designation when attaching' 
  and/or 
'Automatically determine Content-Type for attachment based on extension'.

  I guess what they are meant to be is obvious. Besides,
there can be a case when attached text file(text/plain, text/html)
uses character set different from other part of message as specified
in 'charset' of Pine configuration. Hence, it'd be nice to have
Pine ask for charset field when attaching 'text/*' file.

  I wish this would be cosnidered carefully and reflected in
next release of Pine. 

   Jungshik Shin

---

From: Rudolf Kompf <[email-masked]>
Date: Wed, 25 Sep 1996 10:10:45 +0200 (MET DST)

On 24 Sep 1996, Jungshik Shin wrote:

->   Some mail/news  programs including Pine(with an appropriate entry in
-> mailcap)  can be configured to launch a web browser to display
-> text/html. My ~/.mailcap contains following line, which works
-> with most mail client/news reader endorsing mailcap(e.g. Pine, Tin,Elm)
-> 
-> text/html; xterm -e lynxpipe %s
-> 
-> where lynxpipe is a shell script shown below.
-> 
-> --------------
-> #!/bin/sh
-> trap 'rm -f /tmp/$$.*; exit 1' 1 2 15
-> IN=$1
-> test  $IN || { IN=/tmp/$$.stdin ;cat >$IN; }
-> cp $IN $IN.html
-> lynx  $IN.html
-> /bin/rm /tmp/$IN.html
-> /bin/rm /tmp/$$*
-> -------------
-> 
->   Netscape-Mail is also able to display text/html in mail message 
-> as it should be the case because it's a web browser. 
-> 
->   Problem with Pine is that there's no way to attach HTML file
-> with Content-Type header text/html. Pine blindly put 'text/plain'
-> in "Content-Type: " whether it's html or really plain text.
-> I suspect it also puts 'text/plain' instead of even if it's a 
-> Postscript file. To solve this problem, I suggest a couple of options
-> be added to Pine configuration.  They are 
-> 
-> 'Allow manual Content-Type designation when attaching' 
->   and/or 
-> 'Automatically determine Content-Type for attachment based on extension'.
-> 
->   I guess what they are meant to be is obvious. Besides,
-> there can be a case when attached text file(text/plain, text/html)
-> uses character set different from other part of message as specified
-> in 'charset' of Pine configuration. Hence, it'd be nice to have
-> Pine ask for charset field when attaching 'text/*' file.
-> 
->   I wish this would be cosnidered carefully and reflected in
-> next release of Pine. 
-> 
->    Jungshik Shin
-> 
->    
->     
-> 
I have this line in my ~/.mime.types:
  text/html                      html
and in my ~/.mailcaps:
  text/html; netscape %s ; test=test -n "$DISPLAY"
This works for attached files with .html as suffix (pine 3.95 at linux).

-----------------------------------------------------------------------
Rudolf Kompf                     | E-mail: [email-masked]

---

From: Jungshik Shin <[email-masked]>
Date: Wed, 25 Sep 1996 07:01:25 -0400 (EDT)

I'm afraid I failed to make myself understood as clearly as I wished.

> This works for attached files with .html as suffix (pine 3.95 at linux).

  Of course, it should work although I don't wanna invoke netscape to
display attached HTML. My solution, invoking much lighter lynx instead,
is preferrable to me. Anyway, that's NOT an issue,here. My posting is
NOT about viewing attached HTML file but about attaching HTML file(and
other file in plain text format but not text/plain. e.g. Postscript)  in
Pine. Pine should put 'text/html' in Content-Type header when a file one
wanna attach is 'html' file.  One easy way is determine MIME subtype by
file extension and the other is let users specify MIME type manually.

     Jungshik Shin

---

From: Terry Gray <[email-masked]>
Date: Wed, 25 Sep 1996 11:49:50 -0700 (PDT)

>   I'm afraid I failed to make myself understood as clearly as I wished.

Are you sure that you read Rudolf's reply as clearly as he wished?
He gave you the solution in the information about the .mime.types file.
Or are you saying that you tried that and it didn't work?

-teg

---

From: Jungshik Shin <[email-masked]>
Date: Wed, 25 Sep 1996 20:08:47 -0400 (EDT)

> Or are you saying that you tried that and it didn't work?

  Thanks a lot for poingting this out. 

  I'm sorry I didn't know Pine refer to mime.types to determine what to
write in 'Content-Type:' header when sending out attachment and
accordingly didn't try adding 'text/html html' to ~/.mime.types.  As I
understands him, he wasn't talking about sending html attachment but
about receiving and displaying it, which is not my concern because I
know it works well(whether I use my script lynxpipe or netscape as he
suggested) even without the line("Content-Type: text/html" in header is
sufficient to convince Pine and other MIME-aware programs that it's html
file and .mime.types mechanism is not necessary). Anyway,I guess my
original suggestion still stands worthwhile to consider. That is, it
would not be a bad idea to add option 'Allow manual Content-Type
designation for attachment', which includes allowing 'charset'
specification different from primary charset designated in ~/.pinerc and
other configuration file.

  Another related issue(it's about viewing attached text/html) is the
way Pine handles external viewers that need to use the same tty(terminal
device : I don't  know the exact term to use here) currently under
control  of Pine.  Suppose there are following lines in ~/.mailcap where
lynxpipe is a script to hand over <datafile>(%s) to lynx with suffix
'html' added to the end of temporary file name.

--------
text/html; xterm -e lynxpipe %s; test=test -n "$DISPLAY"
text/html; lynxpipe %s
--------

  When $DISPLAY is defined(i.e. under X window), xterm is launched in
which lynx runs to display text/html and everything works fine while
under text-only terminal Pine doesn't release the control of
'tty'(terminal) to a external viewer and nothing happens except for that
the message 'External viewer is launched' is displayed. My understanding
is this is in a sense intentional for such reason as security.  I wonder
if there's any way to allow external viewers requiring control of the
current termial device to work gracefully without compromising
advantages of not doing so.

  I would be very grateful if Pine team could carefully 
consider my suggestions.

     Jungshik Shin

---

From: Richard Gering <[email-masked]>
Date: Thu, 26 Sep 1996 10:37:19 +0100 (WET)

[ snip ]

> Suppose there are following lines in ~/.mailcap where

If, as you say, the program needs control of the terminal you should
specify the option "needsterminal" in your mailcap file. So, change your
entry for plain terminals into:

   text/html; lynxpipe %s; needsterminal

With this option is specified, Pine will close its tty drivers and give
complete control to the external viewer for the time that program runs. 
After the viewer has terminated, Pine will take back control of the tty.

Hope this helps!

Regards,

- Richard Gering.

+-----------------------------------------------------------------------------+
| Richard Gering ([email-masked]) |      Open minds use Open Systems        |
| CI International. The Netherlands |      (which O.S. are you using?)        |
+-----------------------------------------------------------------------------+