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

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);
Who is Participating?
Eddie ShipmanConnect With a Mentor All-around developerCommented:
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

Geert GOracle dbaCommented:
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

futurelinkswAuthor Commented:
No more answers forthcoming so accepting average solution.
Eddie ShipmanAll-around developerCommented:
Well, accepting ANY solution for an almost year old topic is the right thing.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.