在Google应用脚本gui中显示Gmail邮件 [英] display gmail message in google app script gui

查看:113
本文介绍了在Google应用脚本gui中显示Gmail邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在google apps script web应用程序中显示Gmail邮件内容的最佳方式是什么?
这是我的消息raw html的示例:

  message.getBody(); 

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

所以问题实际上是如何在某个窗口或弹出窗口中显示原始html

解决方案

我认为您所寻找的是 HTML输出类,它允许您在Apps脚本中创建基本HTML文件。



as:

  function myFunction(){
var threads = GmailApp.getInboxThreads();
var messages = threads [0] .getMessages()[0];
var raw = messages.getPlainBody();
返回原始数据;


函数doGet(){
var raw = myFunction();
返回HtmlService.createHtmlOutput('< b>< p> + raw +'< / p>< / b>');
}

允许您创建一个包含用户最后一个内容的HTML文件每当他们访问部署页面时都会收到电子邮件。

我上面的示例非常基本,但您可以整理它以显示您想要的内容。

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

解决方案

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.

这篇关于在Google应用脚本gui中显示Gmail邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆