3 Replies - 272 Views - Last Post: 28 August 2019 - 08:46 AM Rate Topic: -----

#1 VeX85   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-March 19

Outlook mail - how insert image

Posted 28 August 2019 - 08:25 AM

Hey,
need help - how can I insert a picture to send an email via Outlook?

I would like to insert a picture in omsg.HTMLBody so that the recipient can see it in the message.

The application sends a message via Outlook but does not paste the picture.

Public Class mail_awizo

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

            Dim Outl As Object
            Outl = CreateObject("Outlook.Application")
            If Outl IsNot Nothing Then
                Dim omsg As Object
                omsg = Outl.CreateItem(0)
                omsg.To = "[email protected]"
                omsg.cc = "[email protected]"
                omsg.subject = "In the body visible picture"
                omsg.HTMLBody = "<span style='font-family:calibri,serif;'><span style='font-size: 22px;'><strong><span style='color: #1e398a'>PICTURE</span> -> <span style='font-family:calibri,serif;'><span style='font-size: 22px;'>below</span></strong>" _
             & "<br><br><img src='C:\test_pic.jpg'>"
                omsg.Send()
            Else
                MsgBox("sending error")

            End If
   End Sub
End Class




Is This A Good Question/Topic? 0
  • +

Replies To: Outlook mail - how insert image

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15262
  • View blog
  • Posts: 61,196
  • Joined: 12-June 08

Re: Outlook mail - how insert image

Posted 28 August 2019 - 08:30 AM

You could host the image on a website and reference that in the html body.

If you are looking to embed the image directly this does a good job explaining the CID info.

https://social.msdn....mail?forum=vsto
Was This Post Helpful? 0
  • +
  • -

#3 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,209
  • Joined: 12-January 10

Re: Outlook mail - how insert image

Posted 28 August 2019 - 08:31 AM

attachment = MailItem.Attachments.Add("c:\temp\yourimage.jpg")
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F", "someid")
MailItem.HTMLBody = "<html><body>Test image <img src=""cid:someid""></body></html>"


something like the above

basically you have to attach the image and then use the id
Was This Post Helpful? 0
  • +
  • -

#4 VeX85   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-March 19

Re: Outlook mail - how insert image

Posted 28 August 2019 - 08:46 AM

ok, thanks for the answer, I will try
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1