0

Here is my manifest.xml file

<?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>

and spec.xml file

<?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>

This is my code, i have been tried to fetch mail subject and from and to email addresses it has been worked. But the main issue is i can't fetch mail body. Is there any solution to fix this?

Nikhil
  • 1,450
  • 11
  • 24

1 Answers1

0

The answer is to delete the node <Param name="body" value=".*" />

This one had me stuck, as I thought that the <param> node was required to define the name of the output parameter to use in our gadget.

But in fact the MailBodyReaderGadget outputs the parameter of "body" automatically. So the <Param> node is only used if you wish to filter the output.

As you always want to output the body, you can delete this node entirely.

The reason it is not working at the moment is because the .* filter doesn't match return characters (which will be in the body)

Phil
  • 1