Google apps Can';t使用gmail上下文小工具获取邮件正文
这是我的manifest.xml文件Google apps Can';t使用gmail上下文小工具获取邮件正文,google-apps,google-gadget,Google Apps,Google Gadget,这是我的manifest.xml文件 <?xml version="1.0" encoding="UTF-8" ?> <ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009"> <Name>My test gadget</Name> <Description>Test Gmail contextual gadgets for
<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
<Name>My test gadget</Name>
<Description>Test Gmail contextual gadgets for mail body</Description>
<Extension id="MailBodyReaderGadget" type="contextExtractor">
<Name>Mail Body Reader Gadget</Name>
<Url>google.com:EmailBodyExtractor</Url>
<Param name="body" value=".*" />
<Triggers ref="mailBodyTextWidget" />
<Scope ref="emailBody" />
<Container name="mail" />
</Extension>
<!-- our GADGET -->
<Extension id="mailBodyTextWidget" type="gadget">
<Name>Get mail body</Name>
<Url>http://test.com/spec.xml</Url>
<Container name="mail" />
</Extension>
<!-- gadget Scope -->
<Scope id="emailBody">
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url>
<Reason>This app will show the mail body text when you click the button "Show Mail Body"</Reason>
</Scope>
</ApplicationManifest>
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
height="200"
author=""
author_email=""
author_location="US">
<Require feature="dynamic-height"/>
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:EmailBodyExtractor
</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<script type="text/javascript">
document.write([
"\<script src='",
("https:" == document.location.protocol) ? "https://" : "http://",
"ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js' type='text/javascript'>\<\/script>"
].join(''));
</script>
<button id="btn">Show Mail Body</button>
<div id="widget" style="heigth:300px;width:500px;">
</div>
<script>
matches = google.contentmatch.getContentMatches();
for (var match in matches) {
for (var key in matches[match]) {
$("#widget").html(matches[match][key]);
}
}
</script>
]]>
</Content>
</Module>
我的测试工具
测试邮件正文的Gmail上下文小工具
邮件正文阅读器小工具
google.com:EmailBodyExtractor
获取邮件正文
http://test.com/spec.xml
标签:google.com,2010:auth/context/extractor/BODY
当您单击“显示邮件正文”按钮时,此应用程序将显示邮件正文文本
和spec.xml文件
<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
<Name>My test gadget</Name>
<Description>Test Gmail contextual gadgets for mail body</Description>
<Extension id="MailBodyReaderGadget" type="contextExtractor">
<Name>Mail Body Reader Gadget</Name>
<Url>google.com:EmailBodyExtractor</Url>
<Param name="body" value=".*" />
<Triggers ref="mailBodyTextWidget" />
<Scope ref="emailBody" />
<Container name="mail" />
</Extension>
<!-- our GADGET -->
<Extension id="mailBodyTextWidget" type="gadget">
<Name>Get mail body</Name>
<Url>http://test.com/spec.xml</Url>
<Container name="mail" />
</Extension>
<!-- gadget Scope -->
<Scope id="emailBody">
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url>
<Reason>This app will show the mail body text when you click the button "Show Mail Body"</Reason>
</Scope>
</ApplicationManifest>
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
height="200"
author=""
author_email=""
author_location="US">
<Require feature="dynamic-height"/>
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:EmailBodyExtractor
</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<script type="text/javascript">
document.write([
"\<script src='",
("https:" == document.location.protocol) ? "https://" : "http://",
"ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js' type='text/javascript'>\<\/script>"
].join(''));
</script>
<button id="btn">Show Mail Body</button>
<div id="widget" style="heigth:300px;width:500px;">
</div>
<script>
matches = google.contentmatch.getContentMatches();
for (var match in matches) {
for (var key in matches[match]) {
$("#widget").html(matches[match][key]);
}
}
</script>
]]>
</Content>
</Module>
google.com:EmailBodyExtractor
document.write([
"\\"
].加入(“”);
显示邮件正文
matches=google.contentmatch.getContentMatches();
for(匹配中的变量匹配){
对于(匹配项中的var键[match]){
$(“#widget”).html(匹配[match][key])
}
}
]]>
这是我的代码,我一直试图获取邮件主题和从和到电子邮件地址,它已经工作。但主要的问题是我无法获取邮件正文。有什么解决方案可以解决这个问题吗?答案是删除节点 这一次让我陷入困境,因为我认为需要节点来定义要在我们的小工具中使用的输出参数的名称 但实际上MailBodyReaderGadget会自动输出“body”参数。 因此,仅当您希望过滤输出时才使用该节点 由于您始终希望输出主体,因此可以完全删除此节点 它目前无法工作的原因是。*筛选器与返回字符(将在正文中)不匹配