1

对不起我的英语不好。我无法使用自定义提取器获取发件人姓名。我正在尝试从“from_email”和“body”部分获取全部数据(用于测试目的)。结果中只有电子邮件。正文没有“发件人”部分,只有“数据”部分。

这是我的提取器:

<?xml version="1.0" encoding="UTF-8"?> 
<OpenCOBData id="SenderName">  
 <ExtractorSpec platform="gmail" language="en"> 

 <Search input_type="text"> 
 <Pattern input_fields="from_email,body"> 
 <![CDATA[(?P<sender_name>.*)]]> 
 </Pattern> 
 </Search> 

 <Response platform="gmail" format="cardgadget">
 <Output name="senderName">{@sender_name}</Output> 
 </Response> 
 </ExtractorSpec> 

</OpenCOBData>

这是清单的一部分:

<!-- EXTRACTOR --> 

<Extension id="EmailSenderNameExtractor" type="contextExtractor"> 
<Name>Email Sender Name Extractor</Name> 
<Url>781689580671:SenderName</Url> 
<Triggers ref="CustomExtractorGadget"/> 
<Scope ref="emailSenderAddress"/> 
<Scope ref="emailSenderName"/> 
<Scope ref="emailBody"/> 
<Container name="mail"/> 
</Extension> 


<!-- GADGET --> 

<Extension id="CustomExtractorGadget" type="gadget"> 
<Name>Person name extractor</Name> 
<Url>***</Url> 
<Container name="mail"/> 
</Extension> 


<!-- SCOPE --> 

<Scope id="emailSenderAddress"> 
<Url>tag:google.com,2010:auth/contextual/extractor/FROM_ADDRESS</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope> 

<Scope id="emailSenderName"> 
<Url>tag:google.com,2010:auth/contextual/extractor/FROM_PERSONAL</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope> 

<Scope id="emailBody"> 
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope>

怎么了?

4

1 回答 1

2

解决方案是使用内置变量__FROM_PERSONAL__

<Response platform="gmail" format="cardgadget">
    <Output name="senderName">{@__FROM_PERSONAL__}</Output>
    <Output name="senderEmail">{@__FROM_ADDRESS__}</Output>
</Response>

更多:http ://code.google.com/intl/ru/googleapps/support/gadgets/?place=topic%2Fgoogle-apps-gadgets-api%2FlyE8Se0WhGM%2Fdiscussion

于 2011-08-24T21:12:20.453 回答