web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to format email description in a table or line by line using c#

(0) ShareShare
ReportReport
Posted on by

Hi 

I am retrieving crm records and sending email to users using c#. How can I format description to show records line by line or in table format ?

email["subject"] = "Contact Created This Week";

email["description"] = FL;

Fl is the string list containing record names. Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    naresh babu Profile Picture
    425 on at

    If you want in table format, then you should go with html in C# by using string builder.

    For you reference, Please go through below link.

    dynamicspeople.wordpress.com/.../how-to-send-dynamic-html-formatted-table-in-email-body

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    StringBuilder description = new StringBuilder();

    description.Append("Dear Customer <br/> <br/>");

    description.Append("Wish you a very happy birthday and great life ahead. <br/> <br/>");

    description.Append("Regards, <br/>");

    description.Append("Rawish");

    description will be :  

    Dear Customer

    Wish you a very happy birthday and great life ahead.

    Regards,

    Rawish

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    You could build build the table as shown below

    List<string> names = new List<string>(new string[] {"Name 1", "Name 2"});

    StringBuilder nameList = new StringBuilder();

    nameList.Append("<table><tr><th>Name</th></tr>");

    foreach (var name in names)

    {

    nameList.Append($"<tr><td>{name} </td></tr>");

    }

    nameList.Append("</table>");

         email["description"] = nameList;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

#2
Abdullah13 Profile Picture

Abdullah13 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans