Solved

Send embedded image from Resources in VB.Net?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now