I think you might need some conditionals in there, e.g. you might not want
to discard the HTML tag completely, for something like this:
<a href=http://www.mysite.com/>click here!</a>
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Roland Hall" <nobody@nowhere> wrote in message
news:OZVph7aWEHA.1152@TK2MSFTNGP09.phx.gbl...[color=blue]
> "J. Alan Rueckgauer" wrote in message
> news:Od977ySWEHA.3664@TK2MSFTNGP12.phx.gbl...
>
> : "StephenMcC" <StephenMcC@discussions.microsoft.com> wrote in message
> : news:61A8E251-B10C-4F0E-9D39-2F309115B2AD@microsoft.com...
> : > If ur using CDO-NTS maybe have a look at HTMLText/Text properties of[/color]
the[color=blue]
> : Message object, using which depending on how recipient wishes to receive
> : emails!?
> : >
> : [snip]
> :
> : The problem is creating the .TextBody. The source text is stored as[/color]
HTML,[color=blue]
> : so wrapping <html><body> around it and plopping it in .HtmlBody is a
> : no-brainer. You can't just reassign the string for .HtmlBody to
> .TextBody:
> : it doesn't remove the HTML tags, so you get a text message that looks[/color]
like[color=blue]
> : "<html><body><h1>This Week's News</h1></body></html>" which is[/color]
absolutely[color=blue]
> : not what is wanted.
>
> You would probably need to take 3 passes at it or have a more complex
> Regular Expression but you could replace </p> with 2 vbCrLf, <br> or <br[/color]
/>[color=blue]
> with 1 vbCrLf and then use a regexp to remove all HTML tags. Actually any
> block elements should be replaced with vbCrLf.
>
> Something like this...
>
> <%@ Language=VBScript %>
> <%
> Option Explicit
> Response.Buffer = True
>
> ' converts HTML email to plain text
>
> dim re, str, r
> str = lcase("<HTML><HEAD><TITLE></TITLE></HEAD><BODY><p>Heading</p>line[/color]
1<br[color=blue]
> />line 2<br />line 3</BODY></HTML>")
> str = replace(str,"<br />",vbCrLf)
> str = replace(str,"</p>",vbCrLf & vbCrLf)
> set re = new RegExp
> re.Pattern = "<[^>]*>"
> re.Global = true
> re.IgnoreCase = true
> r = re.replace(str,"")
> Response.Write(r)
> set re = nothing
> %>
>
> You can see it here but you need to view the source to see how it would[/color]
turn[color=blue]
> out in an email.
>
http://kiddanger.com/lab/htmlx.asp
>
> FYI.. My email is set to plain text. I get plain text but if it is HTML
> formatted, then the HTML version is an attachment. I never see the HTML
> code in my plain text message body.
>
> HTH...
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -[/color]
http://msdn.microsoft.com/downloads/list/webdev.asp[color=blue]
> MSDN Library -
http://msdn.microsoft.com/library/default.asp
>
>[/color]