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

Embeding images in emails using CDO

701 views
Skip to first unread message

panex

unread,
Feb 6, 2006, 3:53:51 PM2/6/06
to

Hi!

I’ m taking an internship and facing with some problems.

I m working in a ASP page that send emails.

To “assemble” and send the emails I m using the follow commands:

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mym...@mydomain.com"
myMail.To="som...@somedomain.com"
myMail.CreateMHTMLBody "file://c:/mydocuments/test.htm"
myMail.Send
set myMail=nothing

Sometimes the images inside the page don’t work properly, because some
emails server like yahoo and hotmail, detect the message as spam, and
don’t permit to show the images.

So my question is:

Is there a way to embedded image in the email body, and all emails
provider/server accept it?

If yes, how can I do that?

Thanks in advance.

Daniel Panex

--
panex
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Ron Hawkins

unread,
Feb 11, 2006, 4:05:00 PM2/11/06
to
You can use "AddRelatedBodyPart" to embed the image. In your email use this
code:
<img src="image.jpg">

To embed that image use this code:
myMail.AddRelatedBodyPart "c:/images/image.jpg", "image.jpg", 1

Hope that works for you.

Ron H

"panex" <panex....@mail.codecomments.com> wrote in message
news:panex....@mail.codecomments.com...

Incroyable HULK

unread,
Feb 12, 2006, 10:12:53 AM2/12/06
to
I tried this method and it only works properly with OUTLOOK...
Other Email Client (Thunderbird, Eudora) and Webmail Client (Hotmail, Gmail,
AtMail, Yahoo Mail) either show the image as a regular attachment OR the
image isn't there at all...

Any other way?

Incroyable HULK

unread,
Feb 12, 2006, 10:24:26 AM2/12/06
to
Oh wait! I found it!!!

Just add "CID:" in the image url like:

<img src="cid:image.jpg">

And it seems to work perfectly!

0 new messages