Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

inline HTML messages - How?

0 views
Skip to first unread message

j...@my-deja.com

unread,
Oct 26, 1999, 3:00:00 AM10/26/99
to
OK, so I programatically create an email message and fill the .BODY
property with my HTML code and send it to the outbox, but when I view
it, I see the HTML tags, not the code.

Is there a .TYPE property I need to set to indicate a message is not
plain-text, but HTML?


Sent via Deja.com http://www.deja.com/
Before you buy.

Jay B. Harlow [MVP - Outlook]

unread,
Oct 26, 1999, 3:00:00 AM10/26/99
to
jmv,
There is not explicitly a .Type property. But you are close ;-)

There is a .HTMLBody property, that you can set to your HTML Code
(string)...

Hope this helps
Jay

<j...@my-deja.com> wrote in message news:7v36i0$7ie$1...@nnrp1.deja.com...

W.Flamme

unread,
Oct 31, 1999, 2:00:00 AM10/31/99
to
AFAIR there is a different property if you want to use HTML.
Its HTMLBody or sth like that - check the object model.
Don't write to the Body thereafter unless you want to reset
everything back to plain text.

--
Wolfgang Flamme
wfl...@mainz-online.de

<j...@my-deja.com> schrieb in im Newsbeitrag:

Ken Slovak - [MVP - Outlook]

unread,
Nov 1, 1999, 3:00:00 AM11/1/99
to
If you write to Body, you will actually convert it to RTF. That is a
general problem in working with the Body property in code.

--
Ken Slovak
[MVP - Outlook]
Co-author of "Programming Microsoft Outlook 2000"
Chapters 8-13, Appendices
Sams, Sept. 1999


W.Flamme <wfl...@mainz-online.de> wrote in message
news:7vjkn3$r0d$5...@news.rhein-zeitung.DE...

j...@my-deja.com

unread,
Nov 2, 1999, 3:00:00 AM11/2/99
to
OK, that worked just fine. My problem now is, where do the pictures
go? They don't go through.


In article <usrsywCI$GA....@cppssbbsa02.microsoft.com>,


"Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> jmv,
> There is not explicitly a .Type property. But you are close ;-)
>
> There is a .HTMLBody property, that you can set to your HTML Code
> (string)...
>
> Hope this helps
> Jay
>

> <j...@my-deja.com> wrote in message news:7v36i0$7ie$1...@nnrp1.deja.com...


> > OK, so I programatically create an email message and fill the .BODY
> > property with my HTML code and send it to the outbox, but when I
view
> > it, I see the HTML tags, not the code.
> >
> > Is there a .TYPE property I need to set to indicate a message is not
> > plain-text, but HTML?
> >
> >

Jay B. Harlow [MVP - Outlook]

unread,
Nov 2, 1999, 3:00:00 AM11/2/99
to
jmv,
Good question. Don't have a answer directly.

Where do the pictures go when you create a HTML message with just the user
interface?

Doing a quick test, it looks like:
<IMG align=baseline alt=SUS border=0 hspace=0
src="cid:600584600@03111999-2576">

Which I believe is multi-format MIME stuff...

When I was composing the above message it looked like:
<IMG align=baseline alt=SUS border=0 hspace=0
src="C:\WEBSHARE\WWWROOT\images\suswine.gif">

So, I would say put the pictures on your hard disk, create the IMG link to
the file. Use "file:///C:/WEBSHARE/WWWROOT/images/suswine.gif" if needed...

Then when Outlook sends it, will package every nice & neat for you....

Hope this helps
Jay

<j...@my-deja.com> wrote in message news:7vmsrl$vf1$1...@nnrp1.deja.com...

j...@my-deja.com

unread,
Nov 3, 1999, 3:00:00 AM11/3/99
to
Hmmm... I'm not sure what you mean by an 'image link', but I did use
the full path in the src = "" parameter, and even tried:
src = "file:///C:/WEBSHARE/WWWROOT/images/suswine.gif", if that is
what you meant. Problem is, it looks great in the outbox, but try
sending it to yourself, then remove the graphics and receive your
mail. Blank! So outlook doesn't package anything as I was fooled into
thinking before I played 'the Emperors new clothes' by emailing a blank
html email to almost 1000 people.
Or am I misunderstanding you? All my HTML books tell me nothing. I
don't have a lot of hope for the $100 worth of books I just bought
either.

Thanks for the help.


In article <ew8xVhZJ$GA.232@cppssbbsa05>,


"Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> jmv,

> Good question. Don't have a answer directly.
>
> Where do the pictures go when you create a HTML message with just the
user
> interface?
>
> Doing a quick test, it looks like:
> <IMG align=baseline alt=SUS border=0 hspace=0
> src="cid:600584600@03111999-2576">
>
> Which I believe is multi-format MIME stuff...
>
> When I was composing the above message it looked like:
> <IMG align=baseline alt=SUS border=0 hspace=0
> src="C:\WEBSHARE\WWWROOT\images\suswine.gif">
>
> So, I would say put the pictures on your hard disk, create the IMG
link to
> the file. Use "file:///C:/WEBSHARE/WWWROOT/images/suswine.gif" if
needed...
>
> Then when Outlook sends it, will package every nice & neat for
you....
>
> Hope this helps
> Jay
>

W.Flamme

unread,
Nov 3, 1999, 3:00:00 AM11/3/99
to
Ken,
thank you for the information.
Btw: Do you know of any possibility to use write protected
Text in OL-rtf (despite ActiveX-RTF-controls)?

--
Wolfgang Flamme
wfl...@mainz-online.de

Ken Slovak - [MVP - Outlook] <kens...@worldnet.att.net>
schrieb in im Newsbeitrag: #QV0xeHJ$GA.276@cppssbbsa04...

Jay B. Harlow [MVP - Outlook]

unread,
Nov 3, 1999, 3:00:00 AM11/3/99
to
jmv,
Use a IMG tag. something like my sample.

---x--- cut here sample below ---x---


<IMG align=baseline alt=SUS border=0 hspace=0
src="C:\WEBSHARE\WWWROOT\images\suswine.gif">

---x--- cut here sample above ---x---

Replace the value of the 'src' attribute with your file name...

I just tried it with Outlook 2000 and MSN, works perfectly.

Hope this helps
Jay

<j...@my-deja.com> wrote in message news:7vohc2$6ve$1...@nnrp1.deja.com...

j...@my-deja.com

unread,
Nov 4, 1999, 3:00:00 AM11/4/99
to
Works perfectly? I used the same format. You mean, you sent it to
yourself and removed the file from your hard disk before checking your
mail so it did not have "C:\WEBSHARE\WWWROOT\images\suswine.gif" to
refer to? Because, when I did it with outlook 98, the pictures were
blank, unless I restored the deleted files.


In article <uuJp8PmJ$GA....@cppssbbsa02.microsoft.com>,

Ken Slovak - [MVP - Outlook]

unread,
Nov 4, 1999, 3:00:00 AM11/4/99
to
Only thing I can think of is to make the field read-only and maybe not
enabled. In code the read-only attribute is called Locked. Not sure if
that will work with RTF ActiveX controls though.

--
Ken Slovak
[MVP - Outlook]
Co-author of "Programming Microsoft Outlook 2000"
Chapters 8-13, Appendices
Sams, Sept. 1999


W.Flamme <wfl...@mainz-online.de> wrote in message

news:7vq7n5$7r$7...@news.rhein-zeitung.DE...

Jay B. Harlow [MVP - Outlook]

unread,
Nov 4, 1999, 3:00:00 AM11/4/99
to
jmv,
Yes I deleted the file before I read the incoming e-mail.

It may be that Outlook 2000 works correctly, Outlook 98 it does not.

It sounds like you are using Outlook 98, have you tried Outlook 2000? For
sending? For Reading?

Have you tried it via the user interface? So as to rule out coding
problems...

Hope this helps
Jay

<j...@my-deja.com> wrote in message news:7vs6j4$qcs$1...@nnrp1.deja.com...

j...@my-deja.com

unread,
Nov 5, 1999, 3:00:00 AM11/5/99
to
Oh... I am SO sick of upgrading.... I upgraded to 2000 at the office
and all my MAPI stuff broke! Well, guess I will test it there. Sure
would be nice if stuff actually worked after 4 or more years.....


In article <ODYPvayJ$GA....@cppssbbsa02.microsoft.com>,


"Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> jmv,

> Yes I deleted the file before I read the incoming e-mail.
>
> It may be that Outlook 2000 works correctly, Outlook 98 it does not.
>
> It sounds like you are using Outlook 98, have you tried Outlook 2000?
For
> sending? For Reading?
>
> Have you tried it via the user interface? So as to rule out coding
> problems...

As for user interface, I get RTF instead of html.

Jay B. Harlow [MVP - Outlook]

unread,
Nov 5, 1999, 3:00:00 AM11/5/99
to
jmv,
Actually, don't upgrade yet...

From home send yourself an HTML email with a picture in it to work. Did it
make it?

From work send yourself an HTML email with a picture in it to home. Did it
make it?

Then you can code based on what the sender requires or the receiver
requires. If you are just sending pictures from home, to others. You can
keep Outlook 98, if the recipients can still read them... It may be the
recipients need to upgrade...

Hope this helps
Jay

<j...@my-deja.com> wrote in message news:7vtrff$1tk$1...@nnrp1.deja.com...

j...@my-deja.com

unread,
Nov 6, 1999, 3:00:00 AM11/6/99
to
Hope you are not getting too bored....
Here is my test code:
--------------------------
ol = CreateObject("Outlook.Application")
olMAPI =ol.GetNameSpace("MAPI")
olMAPI.Logon('jmv')
cmail = ol.CreateItem(4)
msgs = olMAPI.folders.item(1).folders("Outbox").items
newmail = msgs.add()
newmail.HTMLBody = [<HTML><HEAD><img src="h:\fox\remmail\Msaccess.jpg"
width="464" height="696"></BODY></HTML>]
newmail.display
---------------------------
Picture is there. I send it... no picture. I tried at the office, with
Outlook 2000, same. If the picture actually exists as referenced, it
will show.

I've tried stripping out the path in the <IMG> tag, and including the
picture as an attacment ie:
newmail.attachments.add ("h:\fox\remmail\Msaccess.jpg"), and that
works!

It's a kludge, and I really want to know how to do it the way Netscape
and various other sources seem to do it, without attachments.
Guess I can't have everything in life, eh?

In article <eJG$50#J$GA.249@cppssbbsa05>,


"Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> jmv,

> Actually, don't upgrade yet...
>
> From home send yourself an HTML email with a picture in it to work.
Did it
> make it?
>
> From work send yourself an HTML email with a picture in it to home.
Did it
> make it?
>
> Then you can code based on what the sender requires or the receiver
> requires. If you are just sending pictures from home, to others. You
can
> keep Outlook 98, if the recipients can still read them... It may be
the
> recipients need to upgrade...
>
> Hope this helps
> Jay
>

Jay B. Harlow [MVP - Outlook]

unread,
Nov 7, 1999, 3:00:00 AM11/7/99
to
jmv,

BUT CAN YOU SEND IT WITHOUT USING YOUR CODE???? In other words can you send
one from home & one from work, to the other using just the user interface???

Please answer this one question for me! I want to rule out Outlook version
and mail servers...

BTW: Your newmail.HTMLBody assignment line below looks badly formed, is this
the code you are using. What does the square brackets give you?? If you do a
MsgBox newmail.HTMLBody after setting the HTMLBody property what is printed?

Thanks
Jay

<j...@my-deja.com> wrote in message news:801jpi$knn$1...@nnrp1.deja.com...

Jay B. Harlow [MVP - Outlook]

unread,
Nov 7, 1999, 3:00:00 AM11/7/99
to
jmv,
BTW: I am not getting too bored.

We will get this working for you yet!

j...@my-deja.com

unread,
Nov 12, 1999, 3:00:00 AM11/12/99
to
You know, I just don't remember anything anymore. I believe I got it
to work by sending from WORD by using the 'Send to email recipient'
option, but If I cut HTML and paste it, even though my default send is
HTML, I get tags, so that doesn't cut it. My Jaz with some crucial
info crashing hasn't helped and now I am gone for a week, but it seems
if I use Netscape to 'send a page' or Word? Don't remember what I did,
it works. I'll have to hammer at it when I get back. Like I said, if
I attach the pictures and no path in the html file, it works.

Square brackets? I'm using Foxpro. Life is a pain for us, because VBA
code is a little different. Anyway, in Fox, brackets are equivelent to
quotes. Nice not to have to do the chr$(34) crap we used to do in
Basic.

In article <O7hfTiZK$GA....@cppssbbsa02.microsoft.com>,


"Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> jmv,
>

> BUT CAN YOU SEND IT WITHOUT USING YOUR CODE???? In other words can
you send
> one from home & one from work, to the other using just the user
interface???
>
> Please answer this one question for me! I want to rule out Outlook
version
> and mail servers...
>
> BTW: Your newmail.HTMLBody assignment line below looks badly formed,
is this
> the code you are using. What does the square brackets give you?? If
you do a
> MsgBox newmail.HTMLBody after setting the HTMLBody property what is
printed?
>
> Thanks

j...@my-deja.com

unread,
Nov 12, 1999, 3:00:00 AM11/12/99
to
Forgot to answer this one. After I set the HTMLBody property, I get a
perfect HTML page with graphics! That is because the graphics are on
my machine, but if I send it out, the graphics are not on the
destination machine, and there are picture placeholders of the correct
size, with those little funky X's in there. The source is still
looking at C:\somethingorother\somenonexistantpic.GIF.
No path, attachments, OK. Not the cleanest, but I can live with it.
But I am curious as to how the big boys do it.


>BTW: Your newmail.HTMLBody assignment line below looks badly formed,
is this the code you are using. What does the square brackets give
you?? If you do a MsgBox newmail.HTMLBody after setting the HTMLBody
property what is printed?

Jay B. Harlow [MVP - Outlook]

unread,
Nov 15, 1999, 3:00:00 AM11/15/99
to
jmv,
Not sure what to suggest, I am able to send images in HTML messages...

Jay

<j...@my-deja.com> wrote in message news:80g2rm$uhh$1...@nnrp1.deja.com...


> You know, I just don't remember anything anymore. I believe I got it
> to work by sending from WORD by using the 'Send to email recipient'
> option, but If I cut HTML and paste it, even though my default send is
> HTML, I get tags, so that doesn't cut it. My Jaz with some crucial
> info crashing hasn't helped and now I am gone for a week, but it seems
> if I use Netscape to 'send a page' or Word? Don't remember what I did,
> it works. I'll have to hammer at it when I get back. Like I said, if
> I attach the pictures and no path in the html file, it works.
>
> Square brackets? I'm using Foxpro. Life is a pain for us, because VBA
> code is a little different. Anyway, in Fox, brackets are equivelent to
> quotes. Nice not to have to do the chr$(34) crap we used to do in
> Basic.
>
>
>
> In article <O7hfTiZK$GA....@cppssbbsa02.microsoft.com>,
> "Jay B. Harlow [MVP - Outlook]" <jay_h...@email.msn.com> wrote:
> > jmv,
> >
> > BUT CAN YOU SEND IT WITHOUT USING YOUR CODE???? In other words can
> you send
> > one from home & one from work, to the other using just the user
> interface???
> >
> > Please answer this one question for me! I want to rule out Outlook
> version
> > and mail servers...
> >

> > BTW: Your newmail.HTMLBody assignment line below looks badly formed,
> is this
> > the code you are using. What does the square brackets give you?? If
> you do a
> > MsgBox newmail.HTMLBody after setting the HTMLBody property what is
> printed?
> >

Sue Mosher [MVP]

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
I think the issue here is that Outlook doesn't let you get at the MIME parts
of the header, and the HTML for inline images uses a class ID tied to the
related MIME body part. Code that sets a reference to an image on the local
hard drive is not going to be converted to an inline image.

If you look at the source code for an unsent Outlook HTML message with an
inline image, it looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">


<META content="MSHTML 5.00.2722.2800" name=GENERATOR></HEAD>
<BODY>
<DIV><IMG align=baseline alt="" border=0 hspace=0
src="cid:670160106@18111999-15e8"></DIV>
</BODY></HTML>

See the src= attribute of the <IMG> tag? This is coming from the MIME
header. While you can use CDO to get to the MIME header and add tags, I
don't think you can reliably set a CID for a body part and make sure that
Outlook doesn't change it when the item is sent.

Bottom line is that, you may not be able to send inline images using Outlook
code unless you use a source file that's on the Internet (which is very
annoying to receive if you're not constantly connected and is one reason I
am now stripping all HTML tags from incoming messages).
--
Sue Mosher
Author of
"Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
"Microsoft Outlook 2000 E-mail and Fax Guide" (12/99)

Outlook and Exchange solutions at http://www.slipstick.com

0 new messages