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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert in Outlook email an Image that is shown in the mail

Status
Not open for further replies.

terzaghi

Programmer
Aug 25, 2003
49
0
0
IT
Hi,
I use this code:

____________________________________
Sub SendEmailHTML()

Dim olApp As Outlook.Application
Dim olMail As MailItem

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

With olMail
.to = "aaa@bbb.com"
.Subject = "Trial"
'.HTMLBody = "<html><body><img src="" .Display

End With

Set olMail = Nothing
Set olApp = Nothing

End Sub
____________________________________

That works fine because it lets me create an email in which the image is displayed in the body when it is opened (i.e. the reader see immediately the image). The problem is that in this way the image is on the internet and the PC must be connected in order to see the image. I would like to "insert the image" itself in the mail in order to make the email "complete" with no need for external internet access. I tried with the command

.Attachments.Add "C:\ball.gif", olByValue, , "Attachment"

but the problem is that the image now is not shown immediately in the message body but it is an attachment that the reader has to click.
Does anyone know the correct syntax to insert the image in the email (like attachments.add) but make it appear directly in the message body?

Thanks a lot!
Andrea
 
If it is IN the body, then the body has to be given the actual image file. SRC = always acts as a pointer to the image (or any other src =), not the image itself. Attachments are the same thing, until the mail is truly sent, then the actual attachment file comes along for the ride. However, access to it, as you note, is separate from the body.

So. One way would be use WINHttp. Grab the image file, save it to disk as a byte array, then insert the file into the body. That way the image will be IN the email.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top