Solved

Send embedded image from Resources in VB.Net?

Posted on 2008-10-12
2
532 Views
Last Modified: 2012-05-05
Hi,

I've currently got a form that i'm using to send html emails, however I want to send an image in these email that will always be the same.

Therefore I have added the image to the resources of my form, however I cant seem to embed it in the email.

Can anyone show me how to amend my code to do this?

QuickM_il.My.Resources.Resources.logo is the image I am trying to embed.

Thanks,

Paul.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        OutApp = CreateObject("Outlook.Application")
        OutApp.Session.Logon()
        OutMail = OutApp.CreateItem(0)
 
        PictureBox1.Image = QuickM_il.My.Resources.Resources.logo
 
 
        strbody = "<html><body><font color='red'>TEXT</font></b><br><br><img src=""PictureBox1.Image""></body></html>" & _
                  "Dear all," & vbNewLine & vbNewLine & _
                  "This is a test email." & vbNewLine & _
                  "" & vbNewLine & _
                  "" & vbNewLine & _
                  "Thanks and regards," & _
                  "" & vbNewLine & _
                  "Paul"
    End Sub

Open in new window

0
Comment
Question by:m0tSiE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
tiagosalgado earned 500 total points
ID: 22698390
You must attach the file you want to send and link it with cid
In your html code put something like "<img src='cid:picture1'>"
And use this code to attach the image
msg.AttachInlineFile("C:\me.jpg", "me", "picture1")
 
0
 

Author Closing Comment

by:m0tSiE
ID: 31505459
Cheers Tiger,
I managed to do it using...

.Attachments.Add("c:\temp\candice2.jpg")

And then just typing the filename in the img src field :D
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month4 days, 1 hour left to enroll

630 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