title: Email with embedded image going to junk folder of outlook
body: <p>I am creating an application for sending automatic mail in C#.</p>
  
  <p>This mail contains an embedded image, I am able to generate the automatic mails but it always goes to the junk folder of the receiver. </p>
  
  <p>But if I don't use image then it perfectly goes into the inbox. 
  Please help. Below is the code :</p>
  
  <pre><code>i = 4;
  da.SelectCommand = new SqlCommand("Aniversary_cal", conn);
  da.SelectCommand.CommandType = CommandType.StoredProcedure;
  da.SelectCommand.Parameters.AddWithValue("@flag", i);
  DataTable dt = new DataTable();
  da.Fill(dt);
  
  for (int j = 0; j &lt; dt.Rows.Count; j++)
  {
      string txt = dt.Rows[j]["Mailid"].ToString();
      txt = txt.Replace(" ", "") + "@xyz.com";
      MailAddress To = new MailAddress(txt);
      MailAddress From = new MailAddress("Congratulations@xyz.com", "Congratulations");
      MailMessage msg = new MailMessage(From, To);
      msg.Subject = "Congratulations on your " + i + "th Anniversary";
      string cc = dt.Rows[j]["Managermailid"].ToString();
      cc = cc.Replace(" ", "") + "@xyz.com";
      msg.CC.Add(cc);
  
  
      LinkedResource logo = new LinkedResource("header10yr.jpg");
      logo.ContentId = "companylogo";
  
      LinkedResource logo1 = new LinkedResource("Footer10yr.jpg");
      logo1.ContentId = "display";
  
      AlternateView av1 = AlternateView.CreateAlternateViewFromString("&lt;html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns:st1='urn:schemas-microsoft-com:office:smarttags' xmlns='http://www.w3.org/TR/REC-html40' xmlns:ns0='http://schemas.microsoft.com/office/2004/12/omml'&gt; &lt;head&gt; &lt;meta http-equiv=Content-Type content='text/html; charset=us-ascii'&gt; &lt;meta name=ProgId content=Word.Document&gt; &lt;meta name=Generator content='Microsoft Word 11'&gt; &lt;meta name=Originator content='Microsoft Word 11'&gt; &lt;link rel=File-List href='Document7_files/filelist.xml'&gt; &lt;link rel=Edit-Time-Data href='Document7_files/editdata.mso'&gt; &lt;/head&gt;&lt;body&gt; &lt;center style=font-family:Times New Roman; font-size:larger&gt;&lt;br /&gt;&lt;br /&gt; &lt;table style=width:750;font-style:italic;background-color:rgb(188,67,91); border:1px solid #000&gt;&lt;tr&gt;&lt;td&gt;&lt;img src='cid:companylogo' runat=server  width=750 height=150 style=margin-bottom:-7px; border:1px solid #000 /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=text-align:left&gt;Dear " + dt.Rows[j]["Ename"] + "&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br&gt;&lt;span&gt;&lt;center&gt; Hearty congratulations on completion of 4 Years with Infosys. &lt;/center&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br&gt;&lt;span&gt;&lt;center&gt;This certainly is a memorable day for us and we are indeed delighted about this occasion. We would like to &lt;br&gt;  express our sincere appreciation for your continued support and contribution, &lt;br /&gt;through these cherished years.&lt;/center&gt;&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=text-align:left&gt;Regards&lt;/span&gt;&lt;br /&gt;&lt;span style=text-align:left&gt;Team- HR&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=cid:display  runat=server width=750 height=120 style=margin-bottom:-4px; border:1px solid #000 /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;Note:This is a System generated Mail.Please do not reply.&lt;/center&gt;&lt;/body&gt;&lt;/html&gt;", null, System.Net.Mime.MediaTypeNames.Text.Html);
      av1.LinkedResources.Add(logo);
      av1.LinkedResources.Add(logo1);
      msg.AlternateViews.Add(av1);
  
      msg.IsBodyHtml = true;
  
      SmtpClient smtp = new SmtpClient("ip address", 25);
      smtp.Send(msg);
  </code></pre>