<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Send an email from a text variable</title><link>https://community.appian.com/discussions/f/new-to-appian/23021/send-an-email-from-a-text-variable</link><description>Hi everyone, 
 
 I was trying to send an email from a process model (with the &amp;quot;send e-mail&amp;quot; node) where the text to be sent is a text variable that you write in a a!paragraphField. The problem is that in email that you recieve, the linebreaks of the text</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Send an email from a text variable</title><link>https://community.appian.com/thread/89181?ContentTypeID=1</link><pubDate>Fri, 17 Dec 2021 09:38:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6e38a643-c95e-462b-896d-407bc965fb37</guid><dc:creator>Sergio</dc:creator><description>&lt;p&gt;It works! Thanks a lot!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And yes, the html code is&amp;nbsp;&lt;span&gt;&amp;quot;&amp;amp;nbsp;&amp;quot;&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send an email from a text variable</title><link>https://community.appian.com/thread/89156?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 15:18:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59017854-35d5-453e-82d3-7c6feb753301</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;HTML also inherently ignores multiple consecutive spaces.&amp;nbsp; However my function above uses trim() on the input which would have the same effect.&amp;nbsp; I&amp;#39;d say remove the trim() command from the above code and see if that improves anything on your end (i&amp;#39;m not 100% sure one way or the other).&amp;nbsp; If that doesn&amp;#39;t work, you could probably also add another character to the &amp;quot;replacements&amp;quot; list for the &amp;quot;space&amp;quot; character and replace it with the HTML equivalent, which, off the top of my head, is something like &amp;quot;&amp;amp;nbsp;&amp;quot; ... though you might need to look that one up to verify.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send an email from a text variable</title><link>https://community.appian.com/thread/89155?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 15:14:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ff528be8-a2fa-411b-a4c7-43ddff6f578a</guid><dc:creator>Sergio</dc:creator><description>&lt;p&gt;Thanks it is what I want. The only problem is that when you try to put more than one space (like tab), it dosn&amp;#39;t show in the email. Here I show you an example:&lt;/p&gt;
&lt;p&gt;The &lt;span&gt;a!paragraphField&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1639667502389v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The email:&lt;br /&gt;&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1639667555315v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much for your answer!&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send an email from a text variable</title><link>https://community.appian.com/thread/89152?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 14:43:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5825a4d8-c1e7-4dec-acaa-a5e218c1b6a0</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Emails use HTML formatting, which inherently ignores basic line breaks (i.e. the char(10) and char(13) characters or any combination of the two).&amp;nbsp; You would need to write functionality to find and replace any char(10) linebreaks with the html equivalent, &amp;quot;&amp;lt;br/&amp;gt;&amp;quot;.&amp;nbsp; While you&amp;#39;re at it, it&amp;#39;s also a good idea to sanitize 3 other problematic characters - &amp;quot;&amp;lt;&amp;quot;, &amp;quot;&amp;gt;&amp;quot;, and &amp;quot;&amp;amp;&amp;quot;, each of which should be replaced by their HTML equivalents.&lt;/p&gt;
&lt;p&gt;What I&amp;#39;ve gradually come up with is a &amp;quot;sanitization&amp;quot; expression rule that usually looks something like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!characters: {
    &amp;quot;&amp;amp;&amp;quot;,
    &amp;quot;&amp;gt;&amp;quot;,
    &amp;quot;&amp;lt;&amp;quot;,
    char(10),
    char(13)
  }, /* the ordering of these is important. */

  local!replacements: {
    tohtml(&amp;quot;&amp;amp;&amp;quot;),
    tohtml(&amp;quot;&amp;gt;&amp;quot;),
    tohtml(&amp;quot;&amp;lt;&amp;quot;),
    &amp;quot;&amp;lt;br/&amp;gt;&amp;quot;,
    &amp;quot;&amp;quot;
  },

  reduce(
    fn!substitute,
    trim(ri!input),
    a!forEach(
      local!characters,
      {
        fv!item,
        local!replacements[fv!index]
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>