Email is not formatted while editing

I am sending an email which has an edit email option button.

When I am sending without editing the email, it is well formatted as written in my expression rule.

When I am sending the email, after clicking the edit email button, it is getting stored in the PV and the email comes like a whole paragraph

How to deal with it?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    In general, the Send Email node uses HTML for the email body - so if you pass in plaintext from Appian, things like linebreaks will be ignored in the resulting email.

    I'm not sure exactly what setup you're trying to accomplish here, but a simple solution might be to wrap the text you're passing into the Send Email node within a rule that does necessary HTML substitutions, such as replacing linebreaks (char(10)) with HTML linebreaks (<br/>), and potentially other characters that could need HTML conversion (the "&" character is sometimes tricky, for example).

    For a more advanced approach, I personally almost always default to using an HTML template with replacement keys, into which you can pass further text containing already-formatted HTML.  This allows for the greatest control and flexibility in my opinion, but is also slightly more complicated to set up than using the WYSIWYG email editor.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    Hey Mike, so im having the same issue. what im trying to accomplish is that, pass the email body from script task(including application information and attachments), then display it on a form for the sender as editable email body to add or delete the content and finally pass it to the send email smart service and send it. 

    the problem I have is that, 1. when I pass the email body from the script task as a text with structured spacing, the email will become one paragraph when it gets to the receiver. 2.  when I use expression to keep the formatting the same, all the HTML characters (<b>) shows on the second step where the sender edits the email body. 

    Please advice. 

  • After editing the email body text in the interface, apply the substitute function to replace the char(10) with <br>.

    Example substitute(pv!editedEmailBody, char(10),"<br>")

    You can apply this function either in the interface level or process level.

    Test Run:

    substitute(
    "This is the text from expression.
    This is the new line from the expression",
    char(10),
    "<br>"
    )

    Output:

    This is the text from expression.
    This is the new line from the expression