Forum Discussion

jaread83's avatar
jaread83
Champion
7 years ago

Notes - plain text body in email notification?

On the notification emails for subscriptions, there is a variable called

 

${notification.plainTextBody}

But the notes message only has this:

 

 

${note.getBody()}

I can't seem to find any alternative version of this that removes all the HTML like the one used on general notification emails.

Is there a way to get the plain text version of the content? currently, anyone with their email set to only see the text version will get all the HTML when they receive a private message and its unreadable to normal users.

Any advice would be greatly appreciated.

Thanks!

  • jaread83 - There is no alternative context object which is mentioned in the documentation. However, as a workaround, you can remove all the HTML using velocity method. 

     

    Can you give a try to below two methods. 

    ${note.getBody().replace("</?[^>]+/?>", "")}
    ${note.getBody().replaceAll("</?[^>]+/?>", "")}

    I found this from here

     

    • jaread83's avatar
      jaread83
      Champion
      Hi Tariq, good to see you!

      I will certainly give that a try :) Using regex seems like an elegant solution!

      I don't know why there wouldn't be a text only alternative to the body message as part of the system. I might need to raise a product idea about it.