Convert HTML to RTF to send e-mail?

Convert HTML to RTF to send e-mail?

Post by Gary Fric » Fri, 06 Aug 1999 04:00:00



Requirement: Display dynamic HTML form to browser then allow user to send
output to e-mail.
Problem:        Output gets sent with HTML tags.  Can't format to ASCII text
or RTF.

When I try to send the output with the GET method, I get HTML tags and text.
If I send it with the POST method, I get absolutely nothing.  I specified
ENCTYPE="text/plain" and "text/html" and it makes no difference either.  I
have provided a test example for anyone to comment on.

Thanks,
Gary


<% Response.Buffer = true; %>
<HTML>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<HEAD>
</HEAD>
<BODY>

<%
name_array = new Array("Apples","Oranges","Pears","Bananas","Peaches");
Session("Names") = name_array;
str = (
 'Response.Write("<table>");'+
 'for (i=0;i<5;i++) '+
   '{' +
    'Response.Write("<tr><td>" + Session("Names")[i] + "</td></tr>");'+
   '}'+
 'Response.Write("</table>");'
 );
 eval(str);

%>
 <form id=mailform method="get" ENCTYPE="text/html"

 <INPUT NAME=subject TYPE=hidden VALUE="Itineray for " +
<<%=Session("first_name")%> +'&nbsp' + <%=Session("last_name")%> >
   <TEXTAREA NAME=body COLS=0>
  <%=eval(str)%></TEXTAREA>
  <input type=submit name=mailbut value="Send Mail" >
 </form>
</BODY>
</HTML>

 
 
 

Convert HTML to RTF to send e-mail?

Post by MS » Fri, 06 Aug 1999 04:00:00


Hi Gary,


Quote:> When I try to send the output with the GET method, I get HTML tags and
text.
> If I send it with the POST method, I get absolutely nothing.  I specified
> ENCTYPE="text/plain" and "text/html" and it makes no difference either.  I
> have provided a test example for anyone to comment on.

Don't you mean the other way around? Usually, GET sends nothing and POST
sends the data.

Quote:> str = (
>  'Response.Write("<table>");'+
>  'for (i=0;i<5;i++) '+
>    '{' +
>     'Response.Write("<tr><td>" + Session("Names")[i] + "</td></tr>");'+
>    '}'+
>  'Response.Write("</table>");'
>  );
>  eval(str);

I can't imagine why you are doing this! :-) What is wrong with just building
a string normally:

    var s = "<table>\n";
    for (i=0;i<5;i++)
        s += "<tr><td>" + Session("Names")[i] + "</td></tr>\n";

    s+= "</table>\n";
    Response.Write(s);

Anyway, the following works just fine:

<html>
<head>
<title>Mail Form Test</title>
</head>
<body>

<textarea name="data">
</textarea>
<input type="submit">
</form>
</body>
</html>

Peter

--

Microsoft Windows Script Program Manager.
http://msdn.microsoft.com/scripting

 
 
 

Convert HTML to RTF to send e-mail?

Post by Gary Fric » Fri, 06 Aug 1999 04:00:00


Hi Peter,

     Yes, I would have figured that GET would send nothing and POST the
opposite. Go figure.

     The reason I am building the strings this way is because that is the
only way I could figure to generate output that could be used to display as
well as send.  Is there an easier way that you can suggest?  I would be
happy if I could avoid building this eval string.

Thanks,
Gary


>Hi Gary,



>> When I try to send the output with the GET method, I get HTML tags and
>text.
>> If I send it with the POST method, I get absolutely nothing.  I specified
>> ENCTYPE="text/plain" and "text/html" and it makes no difference either.
I
>> have provided a test example for anyone to comment on.

>Don't you mean the other way around? Usually, GET sends nothing and POST
>sends the data.

>> str = (
>>  'Response.Write("<table>");'+
>>  'for (i=0;i<5;i++) '+
>>    '{' +
>>     'Response.Write("<tr><td>" + Session("Names")[i] + "</td></tr>");'+
>>    '}'+
>>  'Response.Write("</table>");'
>>  );
>>  eval(str);

>I can't imagine why you are doing this! :-) What is wrong with just
building
>a string normally:

>    var s = "<table>\n";
>    for (i=0;i<5;i++)
>        s += "<tr><td>" + Session("Names")[i] + "</td></tr>\n";

>    s+= "</table>\n";
>    Response.Write(s);

>Anyway, the following works just fine:

><html>
><head>
><title>Mail Form Test</title>
></head>
><body>

><textarea name="data">
></textarea>
><input type="submit">
></form>
></body>
></html>

>Peter

>--

>Microsoft Windows Script Program Manager.
>http://msdn.microsoft.com/scripting

 
 
 

Convert HTML to RTF to send e-mail?

Post by MS » Fri, 06 Aug 1999 04:00:00


Hi Gary,


Quote:>      Yes, I would have figured that GET would send nothing and POST the
> opposite. Go figure.

What about with the sample form I posted before? Does that work (it should
do!)

Quote:>      The reason I am building the strings this way is because that is the
> only way I could figure to generate output that could be used to display
as
> well as send.  Is there an easier way that you can suggest?  I would be
> happy if I could avoid building this eval string.

Can't you just Response.Write() the string again inside your text area? At
first I couldn't believe you were doing the eval, and then I saw that you
used the string further on... but the dynamically-built string should be no
different (from what I saw of the code - maybe I missed something).

Peter

P.S. Please tell your bosses to stop supporting Linux and instead only sell
Windows 2000 ;-) Ha ha ha ha ha

--

Microsoft Windows Script Program Manager.
http://msdn.microsoft.com/scripting

 
 
 

Convert HTML to RTF to send e-mail?

Post by Gary Fric » Sat, 07 Aug 1999 04:00:00


No, the sample you sent doesn't work either.  Perhaps it has something to do
with running this on NT workstation and PWS.  We run outlook and Exchange as
our e-mail system.  Regardless of what address I specify in the 'mailto:' it
always puts up an outlook 'new mail message' dialog box outfitted with my
personal e-mail address and nothing is in the 'body' section.  Shouldn't it

something?

Thanks,
Gary


>Hi Gary,



>>      Yes, I would have figured that GET would send nothing and POST the
>> opposite. Go figure.

>What about with the sample form I posted before? Does that work (it should
>do!)

>>      The reason I am building the strings this way is because that is the
>> only way I could figure to generate output that could be used to display
>as
>> well as send.  Is there an easier way that you can suggest?  I would be
>> happy if I could avoid building this eval string.

>Can't you just Response.Write() the string again inside your text area? At
>first I couldn't believe you were doing the eval, and then I saw that you
>used the string further on... but the dynamically-built string should be no
>different (from what I saw of the code - maybe I missed something).

>Peter

>P.S. Please tell your bosses to stop supporting Linux and instead only sell
>Windows 2000 ;-) Ha ha ha ha ha

>--

>Microsoft Windows Script Program Manager.
>http://msdn.microsoft.com/scripting

 
 
 

Convert HTML to RTF to send e-mail?

Post by MS » Sat, 07 Aug 1999 04:00:00



> No, the sample you sent doesn't work either.  Perhaps it has something to
do
> with running this on NT workstation and PWS.  We run outlook and Exchange
as
> our e-mail system.  Regardless of what address I specify in the 'mailto:'
it
> always puts up an outlook 'new mail message' dialog box outfitted with my
> personal e-mail address and nothing is in the 'body' section.  Shouldn't
it

> something?

Ahhhh, OK. It works fine with Outlook Express and should work fine with
other "real" internet mail systems <g>.

Is there anything on the knowledgebase about using Outlook for submitting
forms with the mailto: format? My best guess here is that Outlook simply
doesn't support the feature.

Peter

--

Microsoft Windows Script Program Manager.
http://msdn.microsoft.com/scripting

 
 
 

Convert HTML to RTF to send e-mail?

Post by Gary Fric » Sat, 07 Aug 1999 04:00:00


Peter,

    I'm checking out alternatives.  I found a freeware ActiveXObject that
does e-mail stuff.  I going to testdrive it.

Thanks,
Gary




>> No, the sample you sent doesn't work either.  Perhaps it has something to
>do
>> with running this on NT workstation and PWS.  We run outlook and Exchange
>as
>> our e-mail system.  Regardless of what address I specify in the 'mailto:'
>it
>> always puts up an outlook 'new mail message' dialog box outfitted with my
>> personal e-mail address and nothing is in the 'body' section.  Shouldn't
>it

>> something?

>Ahhhh, OK. It works fine with Outlook Express and should work fine with
>other "real" internet mail systems <g>.

>Is there anything on the knowledgebase about using Outlook for submitting
>forms with the mailto: format? My best guess here is that Outlook simply
>doesn't support the feature.

>Peter

>--

>Microsoft Windows Script Program Manager.
>http://msdn.microsoft.com/scripting

 
 
 

1. Sending RTF vs. HTML

I normally send unformatted ASCII text in my messages.  But when replying
to an HTML-formatted message (such as the ones Egroups likes to send),
Pegasus insists on formatting it even if I've tried to remove all
formatting.

Worse, it's sending it in RTF, which some readers (notably IE5, which many
people use to read Egroups) can't read.  I tried to change it to HTML but
that selection is grayed out in Tools -> Options -> Sending Mail.  Any
ideas why?

I'd *like* to set it so it sends formatted text only if *I* tell it to.  
I'd like to turn off the "use formatted text if replying to formatted text"
setting.  Is there any way to do that?

Failing that, I'll just turn off ALL formatting in ALL messages...

Gary

2. Crash Problems

3. Converting rtf attachments to text

4. Target now synchronous messages - problem reading SCSI disks

5. receiving HTML and RTF messages

6. *** IOS Ver 12.09 and GRE Tunnelling ***

7. How to convert an e-mail to HTML

8. HELP!!!!!!

9. SEND html message email attachment in the body of email??

10. When I send HTML with ms IM it doesn't display as html

11. Can't send Styled Text (RTF)

12. Send me a Eudora 3.0 RTF formatted Message