Html table overlapping in mobile browser when sending email with same subject from c# code -


i sending emails our users updated score after each interval of game. sending email same subject same message body updated interval score. when open email in mobile browser creates group of emails , overlaps mail format when send single mail display correctly. not display correctly in grouping. think group because same email id. display correctly on desktop browser. how solve it, please me.

private static stringbuilder createstringformat_forsendingmail(datatable dtteamscoredb, int qtrno, string quater) {     stringbuilder strtable = new stringbuilder();     string strnotes = "",str;     int flag = 0;     bool otadded = false;      try     {         string strteam1 = "", strteam2 = "", strotteam1score = "", strotteam2score = "", strfinalscore1 = "", strfinalscore2="";         strteam1 = dtteamscoredb.rows[0]["team1name"].tostring();         strteam2 = dtteamscoredb.rows[0]["team2name"].tostring();          datatable dtteam = new datatable();          dtteam.columns.add("qtr");         dtteam.columns.add("teamscore1");         dtteam.columns.add("teamscore2");          (int = 1; <= qtrno; i++)         {             datarow dtrow = dtteam.newrow();             dtrow["qtr"] = "qtr" + i;             //dtteam.rows.add[i]["qtr"] = "qtr" + i;             (int dt = 0; dt < dtteamscoredb.rows.count; dt++)             {                 if (convert.toint32(dtteamscoredb.rows[dt]["interval_id"].tostring()) == i)                 {                     dtrow["teamscore1"] = dtteamscoredb.rows[dt]["team1score"].tostring();                     dtrow["teamscore2"] = dtteamscoredb.rows[dt]["team2score"].tostring();                 }                  if (dtteamscoredb.rows[dt]["interval_name"].tostring() == "ot")                 {                     strotteam1score = dtteamscoredb.rows[dt]["team1score"].tostring();                     strotteam2score = dtteamscoredb.rows[dt]["team2score"].tostring();                 }                 if (dtteamscoredb.rows[dt]["interval_name"].tostring() == "f")                 {                     strfinalscore1 = dtteamscoredb.rows[dt]["team1score"].tostring();                     strfinalscore2 = dtteamscoredb.rows[dt]["team2score"].tostring();                 }             }              dtteam.rows.add(dtrow);             dtteam.acceptchanges();         }          //if ot not present add blank          datarow dtotrow = dtteam.newrow();         dtotrow["qtr"] = "ot";         dtotrow["teamscore1"] = strotteam1score;         dtotrow["teamscore2"] = strotteam2score;         dtteam.rows.add(dtotrow);         if (qtrno == 9)         {             datarow dtotrow1 = dtteam.newrow();             dtotrow1["qtr"] = "f";             dtotrow1["teamscore1"] = strfinalscore1;             dtotrow1["teamscore2"] = strfinalscore2;             dtteam.rows.add(dtotrow1);         }         dtteam.acceptchanges();          strtable.append("<pre><table style='width:480px;border-top: 1px solid #000000;' border='0' cellpadding='0' cellspacing='0' >");         strtable.append("<tr><td style='border-left: 1px solid #000000;border-right: 1px solid #000000;border-bottom: 1px solid #000000;' align='center'>&nbsp;" + dtteamscoredb.rows[0]["team1name"].tostring() + "</td>");         strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;' align='center'>&nbsp;" + dtteamscoredb.rows[0]["team2name"].tostring() + "</td></tr>");         strtable.append("<tr><td align='center' style='border-left: 1px solid #000000;border-right: 1px solid #000000;'>" + dtteamscoredb.rows[dtteamscoredb.rows.count - 1]["team1score"].tostring() + "</td>");         strtable.append("<td align='center' style='border-right: 1px solid #000000;'>" + dtteamscoredb.rows[dtteamscoredb.rows.count - 1]["team2score"].tostring() + "</td></tr>");         strtable.append("<tr><td colspan='2' style='border-top: 1px solid #000000;'>&nbsp;</td> </tr>");         strtable.append("<tr><td colspan='2'>");          strtable.append("<table cellpadding='0' border='0' cellspacing='0' style='width:480px;border: 1px solid #000000;'>");         strtable.append("<tr><td style='border-right:1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp;</b></td>");         //strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp;" + strteam1 + "</b></td>");         //strtable.append("<td style='border-bottom: 1px solid #000000;'><b>&nbsp;" + strteam2 + "</b></td></tr>");         (int = 1; <= qtrno; i++)         {             if (qtrno == 9)             {                 strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp; " + + "</b></td>");                  //strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore1"].tostring() + "</td>");                 //strtable.append("<td style='border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore2"].tostring() + "</td></tr>");             }             else             {                 if (quater == "q")                 {                     strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp; " + + "</b></td>");                     //strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore1"].tostring() + "</td>");                     //strtable.append("<td style='border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore2"].tostring() + "</td></tr>");                 }                 else                 {                     strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp;" + + "</b></td>");                     //strtable.append("<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore1"].tostring() + "</td>");                     //strtable.append("<td style='border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[i - 1]["teamscore2"].tostring() + "</td></tr>");                 }             }         }         if (qtrno == 9)         {             strtable.append("<td style='border-bottom: 1px solid #000000;border-right: 1px solid #000000;'><b>&nbsp;extra</b></td>");             strtable.append("<td style='border-bottom: 1px solid #000000;'><b>&nbsp;f</b></td></tr>");         }         else         {             strtable.append("<td style='border-bottom: 1px solid #000000;'><b>&nbsp;ot</b></td></tr>");         }         string strteam1row = "<tr><td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'><b>&nbsp;" + strteam1 + "</b></td>";         string strteam2row = "<tr><td style='border-right: 1px solid #000000;'><b>&nbsp;" + strteam2 + "</b></td>";         string qtrfinal = "";         if (qtrno == 9)         {             qtrfinal = "f";         }         else         {             qtrfinal = "ot";         }          (int j = 0; j < dtteam.rows.count; j++)         {             if (dtteam.rows[j]["qtr"].tostring() != qtrfinal)             {                 if (dtteam.columns[1].columnname.tostring() == "teamscore1")                 {                     strteam1row = strteam1row + "<td style='border-right: 1px solid #000000;border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[j]["teamscore1"].tostring() + "</td>";                 }                  if (dtteam.columns[2].columnname.tostring() == "teamscore2")                 {                     strteam2row = strteam2row + "<td style='border-right: 1px solid #000000;'>&nbsp;" + dtteam.rows[j]["teamscore2"].tostring() + "</td>";                 }             }             else              {                 if (dtteam.columns[1].columnname.tostring() == "teamscore1")                 {                     strteam1row = strteam1row + "<td style='border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[j]["teamscore1"].tostring() + "</td>";                 }                  if (dtteam.columns[2].columnname.tostring() == "teamscore2")                 {                     strteam2row = strteam2row + "<td >&nbsp;" + dtteam.rows[j]["teamscore2"].tostring() + "</td>";                 }             }         }         //strteam1row = strteam1row + "<td style='border-bottom: 1px solid #000000;'>&nbsp;" + dtteam.rows[0]["teamscore1"].tostring() + "</td></tr>";         //strteam2row = strteam2row + "<td>&nbsp;" + dtteam.rows[0]["teamscore2"].tostring() + "</td></tr>";              //for (int t = 0; t < dtteamscoredb.rows.count; t++)             //{             //    if (dtteam.rows[t]["interval_name"].tostring().toupper() == "ot")             //    {              //    }             //    //else             //    //{             //    //    strteam1row = strteam1row + "<td style='border-right:1px solid #000000'>&nbsp;</td></tr>";             //    //    strteam2row = strteam2row + "<td>&nbsp;</td></tr>";             //    //}             //}              strtable.append(strteam1row);             strtable.append(strteam2row);          (int t = 0; t < dtteamscoredb.rows.count; t++)         {             if (dtteamscoredb.rows[t]["notes"].tostring() != " " || dtteamscoredb.rows[t]["notes"].tostring() !=null)             {                 int interval_id = convert.toint32(dtteamscoredb.rows[t]["interval_id"].tostring());                 if (dtteamscoredb.rows[t]["interval_name"].tostring() != "ot")                 {                     if (qtrno == 9)                     {                          if (dtteamscoredb.rows[t]["interval_name"].tostring() == "f")                         {                             strnotes = strnotes + "f" + " : " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                          }                         else                         {                             strnotes = strnotes + "inn " + interval_id + ": " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                         }                     }                     else                     {                         if (quater == "q")                             strnotes = strnotes + "qtr " + interval_id + ": " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                         else                             strnotes = strnotes + "game " + interval_id + ": " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                      }                 }                 else                 {                     if (qtrno == 9)                     {                         strnotes = strnotes + "extra: " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                      }                     else                     {                         strnotes = strnotes + "ot: " + dtteamscoredb.rows[t]["notes"].tostring() + "<br/>";                     }                 }             }         }          strtable.append("</table></td></td>");         strtable.append("<tr><td colspan='2'>&nbsp;</td></tr>");          strtable.append("<tr><td colspan='2' style='border: 1px solid #000000;'><b>&nbsp;notes:</b></td></tr>");         strtable.append("<tr><td colspan='2' style='border-left: 1px solid #000000;border-right: 1px solid #000000;border-bottom: 1px solid #000000;'>" + strnotes + "</td></tr></table><br/></pre>"); strtable.append("<table><tr><td style='font-size:10px; align:center; color:red;'>we want thank our generous sponsors supporting , making event possible.</td></tr>"); strtable.append("<tr><td  align='center'><img src='" + strimageurl + "' alt='our partners' /></td></tr></table>");     return strtable;     }     catch (exception ex)     {         throw ex;     } }  public static bool sendmailmultipleuser(string strfromemailid, string strtoemailid, string strsubject, string strmessage) {     bool mailflag = false;     try     {         smtpclient smtpclient = new smtpclient();         //encrypteduid = objutility.encryptstring(userid);                     mailaddress fromuser = new mailaddress(strfromemailid);         //mailaddress touser = new mailaddress(strtoemailid);          mailmessage mailmsg = new mailmessage();         mailmsg.from = fromuser;         string[] toemailid = strtoemailid.split(',');         (int = 0; < toemailid.length; i++)         {             mailmsg.to.add(toemailid[i].tostring());         }          mailmsg.subject = strsubject;         mailmsg.isbodyhtml = true;         mailmsg.body = strmessage;          smtpclient.send(mailmsg);         mailflag = true;         return mailflag;     }     catch     {         return mailflag;     } } 

the above code have created dynamically create message , send message through email. please me.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -