Kiran Karale

Kiran Karale

  • NA
  • 390
  • 214k

Images are Not View in IE8,IE9 Browser

Feb 3 2012 7:47 AM

Hi,Sir

Now I had attached some images in email body for better apperance , the issue is images in email are shown in ie6 ,ie7 , mozilla ,chrome

        but when it comes to ie8 and ie9 the images are not displaying.
        so,anybody tell me which addition tag is added to display images in IE -8,IE-9 Browser
        I attached some sample code plz follow it.......


        StringBuilder sb = new StringBuilder();

        string Img1 = "<img src=cid:companylogo>";
        string Img2 = "<img src=cid:companylogo1>";

        sb.Append("<html><body>");
        sb.Append("<table>");
        sb.Append("<tr><td class=\"style17\" width=\"50px\"> </td><td class=\"style14\" align=\"center\">"+ Img4 + "</td></tr>");
        sb.Append("<tr><td class=\"style17\" width=\"50px\"></td> <td class=\"style14\" align=\"center\">"+ Img5 +"</td> </tr>");
        sb.Append("</table>");   
        sb.Append("</body></html>");
       
        strString = sb.ToString();    

        MailMessage mail = new MailMessage();

        mail.From = new MailAddress(txtUsername.Text);

        mail.To.Add(txtTo.Text);

        mail.Subject = txtSubject.Text;

        mail.Priority=MailPriority.High;

        string mailbody = txtBody.Text;

       AlternateView htmlView = AlternateView.CreateAlternateViewFromString(strString,null, "text/html");


       LinkedResource log = new LinkedResource("D:\\EmailFormat\\Image\\delivered.png");    
       log.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
       log.ContentId = "companylogo";
       htmlView.LinkedResources.Add(log);
       mail.AlternateViews.Add(htmlView);

       LinkedResource log1 = new LinkedResource("D:\\EmailFormat\\Image\\notdelivered.png");
       log1.ContentId = "companylogo1";
       htmlView.LinkedResources.Add(log1);
       mail.AlternateViews.Add(htmlView);


      mail.IsBodyHtml = true;

      SmtpClient smtp = new SmtpClient();

      smtp.EnableSsl = true;

      smtp.Host = "smtp.gmail.com";
     
      smtp.Port = 587;

      smtp.Credentials = new System.Net.NetworkCredential(txtUsername.Text, txtpwd.Text);

      smtp.Send(mail);


Answers (2)