0
votes

What is the best way to display content of gmail message in google apps script web app? Here's example of my message raw html:

message.getBody();

<div><em><strong><u>TEST</u></strong></em></div>

so the question actually is how to show that raw html in some window or pop-up

1
Sorry, it's not clear what you mean by 'best way'. What are your requirements? How are you currently doing this? Is there a roadblock you've hit?HDCerberus
the only one requirement - somehow display message from raw contentmk_yo

1 Answers

1
votes

I think what your looking for is the HTML Output class which allows you to create basic HTML files in Apps script.

A script such as:

function myFunction() {
var threads = GmailApp.getInboxThreads();
var messages = threads[0].getMessages()[0];
var raw = messages.getPlainBody();
return raw;
}

function doGet() {
   var raw = myFunction();
   return HtmlService.createHtmlOutput('<b><p>'+ raw + '</p></b>');
 }

Will allow you to create a HTML file that has the content of the users last email message whenever they visit the deployed page.

My sample above is very basic, but you can tidy it up to display what you want.