Hi,
I have written an application which is used by sales staff when discussing
products with their customers over the phone. It is a database application
that holds detailed information about their products including pictures to
assist the sales staff describe features to the customer. The next step in
development of the app is to have a button when in a particular product
screen that the seller can press which sends the customer an email with the
picture embedded in an HTML format Outlook message. I have got it to work
superbly, the email is constructed by the application and sent to the outbox
ready for send and receive and looks fine. When the mail is sent however, I
find that the picture is replace by a place holder "X" symbol indicating the
picture was not found.
My initial thoughts were that I hadn't got the "Send Pictures from the
Internet" option ticked, but even when it is, the picture is still missing.
When I look at an email sent to me from someone where the picture was
inserted into the body text of the message, the image is not mentioned as a
link in normal "img" style format it looks like this:
<DIV>
<FONT face=Arial size=2>
<SPAN class=866055209-20072005>
<IMG alt=chesham hspace=0 src="cid:866055 209@20072005-2abd" align=baseline
border=0>
</SPAN>
</FONT>
</DIV>
Does anyone know how you can do this programmaticall y as I suspect if I just
copy the above HTML code it won't work as the "cid:866055209@ 20072005-2abd"
is probably specific to the individual instance of the picture sent to me,
it is clearly constructed using the date (UK format). I really need to
understand how Outlook constructs that code and embeds the picture and
indeed if there is a process I can call programmaticall y that does the
erquivalent of a user embedding the picture manually.
I currently do the following in code:
I have some declarations at the top of the class module:
Private OApp As Outlook.Applica tion
Private email As Outlook.MailIte m
Private oNameSpace As Outlook._NameSp ace
Private oOutboxFolder As Outlook.MAPIFol der
Then in the subroutine that hangs off a small form that allows the user to
enter the adressee's email and message subject line I have (removed try
catch block and error checking for simplicity):
Dim EmailAddress, ToAddress, BodyHTML, Salutation As String
EmailAddress = txtEmail.Text
Salutation = txtSalutation.T ext
OApp = New Outlook.Applica tion
oNameSpace = OApp.GetNamespa ce("MAPI")
oNameSpace.Logo n("outlook", "", False, False)
oOutboxFolder =
oNameSpace.GetD efaultFolder(Ou tlook.OlDefault Folders.olFolde rOutbox)
... here I construct a string called BodyHTML which is just the
HTML code for the message body ..
email = OApp.CreateItem (OlItemType.olM ailItem)
email.To = EmailAddress
email.Subject = "Details of the Item you requested."
email.HTMLBody = BodyHTML
email.Send()
I need to find out how to build the HTML string so that the picture is
embedded not left behind on the user's PC.
Thanks for any help.
--
Siv
Martley, Near Worcester, UK.