C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Please dont send copied code...


Posted Date: 25 Jul 2008      Total Responses: 0

Posted By: nilesh bahirshet       Member Level: Gold     Points: 1


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




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Post Reply
You must Sign In to post a response.
Next : decreace length
Previous : how to download RJS calender control
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

conference call definitions

Contact Us    Privacy Policy    Terms Of Use