Solved

Send embedded image from Resources in VB.Net?

Posted on 2008-10-12
2
526 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

786 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