title: sending mail along with embedded image using asp.net
body: <p>sending mail along with embedded image using asp.net </p>
  
  <p>I have already used following but it can't work</p>
  
  <pre><code>Dim EM As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text)
          Dim A As System.Net.Mail.Attachment = New System.Net.Mail.Attachment(txtImagePath.Text)
          Dim RGen As Random = New Random()
          A.ContentId = RGen.Next(100000, 9999999).ToString()
          EM.Attachments.Add(A)
          EM.Subject = txtSubject.Text
          EM.Body = "&lt;body&gt;" + txtBody.Text + "&lt;br&gt;&lt;img src='cid:" + A.ContentId +"'&gt;&lt;/body&gt;"
          EM.IsBodyHtml = True
          Dim SC As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient(txtSMTPServer.Text)
          SC.Send(EM)
  </code></pre>