简体   繁体   中英

Printing an Array in EmailTemplate.html by C#

I am using WCF for sending the Email and I have EmailTemplate.html page to create Email Body. I am accessing that with following function

 private string CreateBody(int formNum, string[] names)
    {
        string body= string.Empty;
        using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate.html")))
        {
            body = reader.ReadToEnd();
        }

        body = body.Replace("{formNumber}", ""+formNum);
        // Here I need to add code for array
       return body;
    }

For Accessing the {formNumber} Field I have traditional coding in my EmmailTemplate.HTML page as follows:

                  <tr>
                   <td width="30%">Form Number:</td>
                   <td width="70%"><b>{formNumber} </b></td>
               </tr>

Same like this I have HTML code for other fields..

Now my problem is I got an Array that needs to print on HTML page in EmailTemplate.html. Can anyone please tell me that what I need to add in CreateBody() method so that my array will get shown in EmailTemplate.HTML Also, If I need to make changes on my HTML page please let me know.. (Array is not of Fix size.) Thank You

        for (int i = 0; i < eng.Length; i++)
        {
            body += "<tr>";
            body += "<td>" + acsfbv[i] + "</td>";
            body += "<td>" + ZSFbz[i] + "</td>";
            body += "<td>" + enginzbzxvb[i] + "</td>";
            body += "</tr>";
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM