Hello All, I want to send an Email in outsystems11, where I need to get all details from the user To, CC, and Attachments, Subject, Content - Except content all is fine, I have saved the content returned by CKEditor which given in HTML and i have converted to Binary and Saved that in DB, Here i need to generate the mail once user clicks send Email, I am unable to convert that HTMl to plain text in Email widget as unable to add any client events to call JS. Also, i have tried to fix it by creating a block, but I am unable to call the block in Email.Is there any solution for that?Need to display the content given as input by the user and not the HTML content returned by Editor.Thanks,Rakesh
Hello @Rakesh K ,
To convert this into plain text for use in the OutSystems Email widget, you can use a server-side action that strips HTML tags and decodes HTML entities
Warm Regards,
Vibhor Agarwal
Hello Agarwal, Thanks for responding!I am using an HTML-to-text conversion to produce email content. However, the emails contain tables, and the conversion flattens them into paragraphs rather than preserving the table structure. Could you advise how to keep the table formatting in the plain-text version? Thanks,Rakesh
You can use the libraries-:
html2text: Converts HTML to Markdown
html-table-to-text: Specifically designed to convert HTML tables to readable text.
Vibhor
Hi ,
See you can do one thing , you can also save Plain text in one more column for email purpose using the below method So when you want to plain text use it.
referencehttps://www.outsystems.com/forums/discussion/62031/how-to-remove-the-html-tags-from-the-content/
Hello Amit, Thanks for your response,Currently am converting that HTML to text, Am getting as plain text, Is there any way to maintain that same format which is given by User?Thanks
See, you told you have binary text data , so try to use
BinaryDataToText(TEMPLATE_CONTENT, "UTF-8")while bind with mail without removing the html format.
Yes, as Amit said that you need to save the plain version for better results in DB so that you can easily show it on the Email widget.
Alternatively, if you have less content so you can simply use regex for tha like i am getting nice results with less data. Like with this:-
Regex_Replace("<p>Hello User,</p><p>Testing Email,<br>Thanks & Regards,<br>Rakesh</p> ","<[^>]*>",NewLine())
I am getting this, or you can also use "" if you don't want a new line:-
Thanks
Regards
Gourav Shrivastava
Hi @Rakesh K ,
You can below post for reference:
https://www.outsystems.com/forums/discussion/86879/remove-html-tags-in-email-body-of-reactive-aaplication/
https://www.outsystems.com/forums/discussion/88741/to-send-email-with-formatted-data-which-i-got-from-ckeditor-reactive/
regards,
Manish Jawla