473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How does Outlook embed pictures in emails??

Siv
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:866055209@20072005-2abd" align=baseline
border=0>
</SPAN>
</FONT>
</DIV>

Does anyone know how you can do this programmatically 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 programmatically 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.Application
Private email As Outlook.MailItem
Private oNameSpace As Outlook._NameSpace
Private oOutboxFolder As Outlook.MAPIFolder

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.Text

OApp = New Outlook.Application
oNameSpace = OApp.GetNamespace("MAPI")
oNameSpace.Logon("outlook", "", False, False)
oOutboxFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox)

... here I construct a string called BodyHTML which is just the
HTML code for the message body ..

email = OApp.CreateItem(OlItemType.olMailItem)
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.
Nov 21 '05 #1
2 14344
Siv,
Here is an example (requires CDO or Redemption) to add an embedded image
file to a message.

http://www.outlookcode.com/d/code/htmlimg.htm

Hope this helps
Jay

"Siv" <ms**********@removeme.sivill.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
| 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:866055209@20072005-2abd" align=baseline
| border=0>
| </SPAN>
| </FONT>
| </DIV>
|
| Does anyone know how you can do this programmatically 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 programmatically 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.Application
| Private email As Outlook.MailItem
| Private oNameSpace As Outlook._NameSpace
| Private oOutboxFolder As Outlook.MAPIFolder
|
| 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.Text
|
| OApp = New Outlook.Application
| oNameSpace = OApp.GetNamespace("MAPI")
| oNameSpace.Logon("outlook", "", False, False)
| oOutboxFolder =
| oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox)
|
| ... here I construct a string called BodyHTML which is just the
| HTML code for the message body ..
|
| email = OApp.CreateItem(OlItemType.olMailItem)
| 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.
|
|
Nov 21 '05 #2
Siv
Jay,
Many thanks for this, I will pour over it and see if I can a) get my head
round it and b) implement it. Initial look seems to be exactly what I need.
Thanks again.
--
Siv
Martley, Near Worcester, UK.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl...
Siv,
Here is an example (requires CDO or Redemption) to add an embedded image
file to a message.

http://www.outlookcode.com/d/code/htmlimg.htm

Hope this helps
Jay

"Siv" <ms**********@removeme.sivill.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
| 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:866055209@20072005-2abd"
align=baseline
| border=0>
| </SPAN>
| </FONT>
| </DIV>
|
| Does anyone know how you can do this programmatically 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 programmatically 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.Application
| Private email As Outlook.MailItem
| Private oNameSpace As Outlook._NameSpace
| Private oOutboxFolder As Outlook.MAPIFolder
|
| 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.Text
|
| OApp = New Outlook.Application
| oNameSpace = OApp.GetNamespace("MAPI")
| oNameSpace.Logon("outlook", "", False, False)
| oOutboxFolder =
| oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox)
|
| ... here I construct a string called BodyHTML which is just
the
| HTML code for the message body ..
|
| email = OApp.CreateItem(OlItemType.olMailItem)
| 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.
|
|

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob | last post by:
Hi Everybody A tough one!!! Is there any way that incoming eMails (MailItems) into Ms Outlook can be used to automatically create records in a ms Access table or sub table. Smiley Bob
3
by: Curious George the Monkey | last post by:
Hi, I have about 20,000 emails of which about 1% of them have attached word, excel, jpeg, pdf, powerpoint files. The emails are located in about 1000 folders. The hierachy of folders is...
3
by: Strasser | last post by:
In Access2000 mass emailing worked perfectly (very powerful tool!). Doesn't work when using XP version of both Access and Outlook, even though I checked the box to ensure that I was sending the...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
1
by: PhilD | last post by:
My C#.NET console app checks a public folder every 24 hours for incoming emails. For each unread email in the folder, it copies any attachments to the network, then loads the contents of these files...
16
by: Kosmos | last post by:
Good afternoon everyone, just wondering if anyone knew if it's possible to send meetings or appointments through email when you run VBA or SQL code in Access 2003? The following is the code I've been...
6
by: AMP | last post by:
I am trying to write a windows sevice that will send emails. The data is stored in a database and the service scans the database for new entries It work well as a stardard windows app, but when...
4
by: ldynrd49 | last post by:
I am using Outlook Express 6.0 and lately have received some emails with photos or images that do not attach or show in the email. There is a box where the image should be an da smal box with a red...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
How to suppress the Outlook 2003 security prompts from VB2005. When I tried to look at the body of a message or any other part of an outlook mailItem -- I get these annoying security prompts. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.