Learn how to a build a cloud-first strategyRegister Now


Having embedded an image in a HTML email, Outlook still shows it as an attachment. How do I stop that?

Posted on 2008-11-07
Medium Priority
Last Modified: 2012-05-05
Using Delphi7 studio enterprise I am using COM automation to send emails via Outlook. When I use SMTP it is fine, but the embedded images in Outlook also appear as attachments which is untidy.

I have viewed the accepted solution for Q_21929137 and tried it but cannot get the variants fields to work.
Happy to provide code snippets and HTML source of emails, but the attaching of the signature images is as follows:
          for j := 0 to sl1.Count - 1 do
            strSourceFileName := sl1[j];
            strDisplayName := ExtractFileName(sl1[j]);
            // OlAttachmentType can be one of these OlAttachmentType constants.
            //   olByReference   = 4
            //   olByValue       = 1
            //   olEmbeddeditem  = 5
            //   olOLE           = 6

            intAttachType := 1;            
            intPosition := 1;
            oMailItem.MailItem.Attachments.Add(strSourceFileName, intAttachType, intPosition, strDisplayName);
Question by:futurelinksw
  • 2
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22919915
if these images are available on the internet/intranet
and clients have internet/intranet access

you could use the tag <img source=""/>

no included images

LVL 26

Accepted Solution

EddieShipman earned 1000 total points
ID: 23760321
Well, The code below works for me and I have OL2007.
Although after the display, I get a dialog that says "Incorrect Function"

Give it a try and see what you think..

procedure TForm1.Button1Click(Sender: TObject);
  objApp, l_Msg, oAttachs: OLEVariant;
  objApp := CreateOLEObject('Outlook.Application');
  l_Msg := objApp.CreateItem(olMailItem);
  oAttachs := l_Msg.Attachments;
  oAttachs.Add('c:\\feed-icon_orange-24px.bmp', olByValue, 1, 'MyImage');
  l_Msg.HTMLBody := '<IMG align="baseline" border="0" hspace="0" src="cid:feed-icon_orange-24px.bmp">';

Open in new window


Author Closing Comment

ID: 31514306
No more answers forthcoming so accepting average solution.
LVL 26

Expert Comment

ID: 25077764
Well, accepting ANY solution for an almost year old topic is the right thing.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question