Solved

Send embedded image from Resources in VB.Net?

Posted on 2008-10-12
2
523 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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

11 Experts available now in Live!

Get 1:1 Help Now