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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Email Description being stripped of line breaks

(0) ShareShare
ReportReport
Posted on by 125

I am sending an email via a plugin and the description is coming across as an  unformatted text email. In the description attribute I have tried putting \n, \r\n, and even <br/>. I have tried running System.Net.WebUtility.HtmlEncode against it but nothing seems to bring my text over via email in a formatted fashion. I was wondering if there was some setting that I'm missing on the activity (email) entity that may handle this differently or you guys can provide any insight on description/body formatting of email description?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi David,

    You can put html into an email body through a plugin. The only times I've had trouble with it is if I try to use CSS styles, or if the html I'm building is invalid (bad tags, malformed, etc). When you create the email and insert the "<br/>" tag, then look at it in CRM, do you see the text"<br/>" or is there a warning that says the email contains harmful scripts? If you see the html as text, make sure you're encoding it properly. If it's a warning, there's something malformed in the html you're trying to inject. Simplify it to something simple and go from there.

    Hope this helps! I'd appreciate if you'd mark this as a Verified answer.

    Thanks,

     Aiden

  • David Pring Profile Picture
    125 on at

    Yes, after several tests, just inputting HTML directly into the message is the solution.

  • Suggested answer
    Community Member Profile Picture
    on at

    Aiden is on the right path. The following C# code will replace a string's characters so it's displayed as expected in the UI:

    str = str.Replace("\n", "<br/>");

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

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
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans