How to integrate company logo with auto send using vb.net
Outlook stationery really belongs to the Word editor, and there may be an
easy way to do this through Word automation. I can suggest two different
approaches using Outlook
Option #1: You can set the HTMLBody property of your Outlook.MailItem to
repro the stationery that you created, including whatever formatted text you
want in the email. But if you look at the HTML source for your stationery
you will see that the src property of the IMG tag for the company logo looks
something like src="cid:760521916@20082002-17cb". That cid value corresponds
to the PR_ATTACH_CONTENT_ID (&H3712001E) property of a hidden attachment to
the message that holds the image. So in addition to specifying the HTML
source of the message by setting HTMLBody you would need to add the logo
image as an attachment and set its PR_ATTACH_CONTENT_ID. The Outlook object
model will allow you to add the attachment, but to set any properties on an
attachment you would have to use ExMAPI or a component like Redemption.
That's the most flexible approach since you can easily change the HTML and
the image.
Option #2: Reproduce your stationery template using the Outlook HTML editor,
save it as as an OFT file and then use Outlook's CreateItemFromTemplate
method to create your new MailItem. The HTMLBody property of the new
MailItem will contain the full HTML source for the message, including an IMG
src pointing to the hidden attachment of your logo image. You would need to
read that property, parse it to find where to place your message text and
then reset the value of HTMLBody. The coding is simpler, but you need to
rebuild the OFT file if your logo changes.
wrote in message
oups.com...
Hi,
In my VB.NET Windows form application, I'm using the Outlook object to
compose and
automatically send email. The spec also requires that I integrate the
company logo on the top of the email to look like the company
letterhead. I tried creating a html page with the company logo design
on it and set
it as the default stationery. It works when I compose a new email
manually from Outlook. But when the email is composed and sent from
VB.NET code using the Outlook MailItem, for reason beyond my level of
understanding, the default stationery is not used. Instead all I see
is a blank template. I'm fairly new at this game. I greatly
appreciate your help.
|