Edit text received by Send Email action

We have an object class called Billing with property Text, and we use the action Send Email to send Billing.Text (as plain text). Billing.Text is a function with several parameters, and we have formatted it so that it looks good in an email.

We have now discovered that the recipient of the emails needs to be able to format the text in the email they receive in Outlook, but that is not possible. When we try to send it as HTML in the Send Email action, we lose all the formatting we have made in Billing.Text.

Do you know how we can solve this?


When working with HTML email, you need to also provide a HTML template. This can be generated with tools like MJML. Without an HTML template, your text will be sent as-is, with no formatting.

Remember to also provide a plaintext version of the email as a fallback, in case the recipient has turned off HTML email or their client does not support it.

Additionally, you can add text from function params with squiggly brackets or by constructing a template string with JS.

The parameters surrounded by {{double braces}} will be automatically populated by Appfarm when an email is sent.

You can read more about plaintext and HTML mail in our docs at this link :slightly_smiling_face:

Please reach out if this does not solve your problem, or something else is unclear.


Thank you! Then I have two questions:

  • I created a text in mjml.io, clicked “View HTML” and copied the code. Do I now just paste the code into the function in Appfarm? Where do I put the return and the quote signs?
  • In the plain text I have many statements like this: (myProperty ? myProperty : 0) , because I don’t know if the parameters have value or not. Can I do that in HTML as well?

In the function editor, simply write:

return `
<Your HTML here>

To use your expressions in the HTML, you can utilize template strings


const fullName = (user.fullName) ? user.fullName : "Customer";

return `
<h1> Dear ${fullName} </h1>

This will return either “Dear Erik Anker Kilberg Skallevold” if user.fullName has value or “Dear Customer” if user.fullName has no value.

Hope this helps :slightly_smiling_face:


Yes, perfect, thank you! Then all my stupid questions are answered. :slight_smile:

1 Like