please read carefully ...
I have a Picture box on the form ... and I want to send that image with mail which appears in pictute box
Now I have a code that takes the image from folder structure like c:\temp\aaa.jpg It sends image with mail PERFECTLY....
but now I have to send mail which is store in memory stream . not in file...
I have code like
How can I send the image wich stored in memory stream ???
I have code like
Public sub senmail(ByVal image1 as Image)
Dim subject As String = "Test EmbeddedImage" Dim contentId As String = "image1"
Dim body As String = "Here is a picture of CRM: <html><body> <img src=""cid:image1""/> </body><html>
Dim ClientPC As New SmtpClient("ddd.com", 25)
Dim Authentication As New Net.NetworkCredential("nmy@myserver.com", "password")
ClientPC.Credentials = Authentication Dim mSender As New MailAddress("my@myserver.com") Dim mReceiver As New MailAddress("my2@myserver.com") Dim sMail As New MailMessage(mSender, mReceiver)
sMail.Subject = "Testing embedded image 25 july 3.41 PM" Dim av1 As AlternateView = AlternateView.CreateAlternateViewFromString(body, Nothing, MediaTypeNames.Text.Html)
Dim ct, ct1 As New ContentType Dim ct2 As New ContentType("image") ct.MediaType = MediaTypeNames.Image.Jpeg
Dim linkedResource1 As LinkedResource = New LinkedResource(ms, ct.MediaType) <----- gives error here
linkedResource1.ContentId = contentId
av1.LinkedResources.Add(linkedResource1) sMail.AlternateViews.Add(av1) sMail.IsBodyHtml = True ClientPC.Send(sMail)
end sub
|
No responses found. Be the first to respond and make money from revenue sharing program.
|