Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to mail in outlook using html tags

Status
Not open for further replies.

pritiS

Programmer
Jan 16, 2003
11
SG
helo,
im having a problem, which im not able to solve, so its goes like this....in MS Outlook (NOT outlook express, while the mail is compose html tags (like table, para, etc, etc) should be use, but while the receiver view the mail it should be like a webpage, instead of showin the html tags itself...now this can be done using asp..setting object in the server, but i suppose to use only oulook NO server....
so anyone is out there to HELP???
PLZ.....
 
I have written a simple Macro for this, but it is somewhat special because it uses a Perl-Scriptlet. It's basicaly working like this: It encodes the mail body to HTML Entities and places it in an other HTML Body. So you are now editing a HTML Mail containing HTML code. When you start the macro the sencond time, it parses the encoded mail out, decodes it and sets it as the mail body. I think this could be done completely in VBasic, but i have written the encoding & parsing code in Perl ;-)

The macro:
Sub ShowHTML()
Static HtmlViewState As Object
Dim inspector As inspector

If HtmlViewState Is Nothing Then Set HtmlViewState = CreateObject("Scripting.Dictionary")
Set inspector = Application.ActiveInspector
If (Not HtmlViewState.exists(inspector)) Then HtmlViewState.Add inspector, 0

If (TypeName(inspector)) <> &quot;Nothing&quot; Then
If inspector.EditorType = olEditorHTML Then
Dim Coder As Object
Set Coder = CreateObject(&quot;Fozis.HTML.Code&quot;)

If HtmlViewState.Item(inspector) = 0 Then
inspector.CurrentItem.HTMLBody = Coder.encode(inspector.CurrentItem.HTMLBody)
HtmlViewState.Item(inspector) = 1
Else
inspector.CurrentItem.HTMLBody = Coder.decode(inspector.CurrentItem.HTMLBody)
HtmlViewState.Item(inspector) = 0
End If
End If
End If
End Sub

The main Perl code looks something like this:

my $head = &quot;<html><head><body><pre>&quot;;
my $tail = &quot;</pre></body></html>\n&quot;;
my $start = &quot;<!-- Start of HTML Code -->&quot;;
my $end = &quot;<!-- End of HTML Code -->&quot;;

sub encode
{
my $html=shift;
return $head.&quot;\n&quot;.$start.&quot;\n&quot;.HTML::Entities::encode($html).&quot;\n&quot;.$end.&quot;\n&quot;.$tail;
}

sub decode
{
my $html = shift;
($html) = $html =~ /^.*$start\n?(.+)\n?$end.*$/s;
return HTML::Entities::decode($html);
}

I have it in a Perl-Sctipting object, but unless you have ActivePerl installed you shoud try to do these 4 lines in VBasic. ( Good luck ;-D )

Well, it works but it has some (for me, major) drawbacks. It breaks background pictures, for example. It doesn't have syntax highlighting. Outlook messes up a lot. And, I'm not using it that much than I expected.

HTH,

b.m. Fozi
 
thz for the coding, but i cant use coding, not only in peral but also in asp, can set a server object and then the mail can be send. But my prob is i have to use only outlook, if i use the codin as u said then i need a peral server right??? and thts impossible..may be if somethin to do with the mail server then its ok!!!
wht u think?
 
Can you tell me some best method and editing tool, for the requirment i mentione...the whold point is to send emails as webpage, if the webpage is copy paste, then the email is very long , instead of tht if any editing tool or method is use then the page can be mainted....
any idea?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top