How to write code for mails in asp.net?
<p>In web application, How can i find if mail is not delivered. I write code for sending mail, can i get the report of mail deliver failure report.</p>

<pre><code>           objMialBe.Empid =   Session["empid"].ToString();
            string myHost = System.Net.Dns.GetHostName();
            objMialBe.IpAddress = System.Net.Dns.GetHostByName(myHost).AddressList[0].ToString();
            objMialBe.Subject = txtSubject.Text;
            objMialBe.Mbody = txtDescri.Text;
            objMialBe.ValidDays = Convert.ToInt32(txtNoDays.Text);
            objMialBe.SizeInBytes = Tsize.ToString();
            objMialBe.TempAsizebbyte = TotSize;
            objMialBe.TemsizeMb = TotSizeMB;
            objMialBe.SessionId = Session.SessionID.ToString();
            int k = ObjMailBl.Insert_Mails_Sent(objMialBe); // inserting data in table Tbl_Mails_sent
            string TO = txtTo.Text;
            string[] inputArray = TO.Split(';');
            for (int i = 0; i &lt; inputArray.Length; i++)
            {
                int cnt = 1;
                //// Response.Write("#" + i + ": " + inputArray[i] + "&lt;br&gt;");

                MailMessage mail = new MailMessage();
                string t = txtTo.Text;
                mail.To.Add(inputArray[i]);
                mail.To.Add(t);
                mail.From = new MailAddress("iilwebadmin@indimmune.com");
                mail.Subject = txtSubject.Text;
                StringBuilder stbldr = new StringBuilder();
                stbldr.Append("&lt;html&gt;" + txtDescri.Text + "&lt;/html&gt;");

                if (item &gt;= 1)
                {
                    foreach (DataListItem dl in dtlstTemp.Items)
                    {
                        Label latt = (Label)dl.FindControl("lblFileAtt");
                        stbldr .Append ("&lt;html&gt; &lt;a href='http://8888888/*******/mails/CheckAttachment.aspx?attid="+s+"&amp;Eid="+txtTo.Text+"&amp;afile="+latt.Text +"' target='_blank'&gt;Attachment..&lt;/a&gt; "+cnt+" &lt;br&gt; &lt;/html&gt;");
                        cnt++;
                    }  
                }

                mail.Body = stbldr.ToString();
                SmtpClient smtp = new SmtpClient("**********", 25);
                smtp.Send(mail);
</code></pre>
