2010-07-21 75 views
5

我想将电子邮件和附件从Gmail(Google Apps)保存到另一个类似于CRM的功能的数据库中。但是,根据docs,“提取程序无法读取电子邮件附件”。我的问题:是否有可能以某种方式使用电子邮件中的某种标识符(例如EmailTimeExtractor)并使用它来使用IMAP提取附件?我对于上下文小工具还不是非常熟悉,只是想知道在潜水前我是否有可能尝试去做!使用gmail上下文小工具访问附件

+1

附件不是唯一受限制的东西。您还将只能使用gmail-contextual-gadget API获取邮件正文的前1000个字符 – JochenJung 2010-08-12 16:59:19

回答

1

如果您使用标准的imap客户端将邮件拉下来,您将获得附件。这将是其中的一部分。伪代码:

email = new->email_object(); 
remote_mailbox = new->imap_object_creator(username, password, ...) 

while (email = remote_mailbox->download_next_email) { // this downloads the next email 
    foreach part_type (email->parts->next) { // this iterates over the parts of the email 
    if(part_type == 'attachment') { // not sure if this is it exactly, but you'll find it in the mime-type 
     //hooray! you've found an attachment. do what you will with it 
    } 
    } 
} 

当我这样做,我写它在Perl,所以我使用的MIME ::工具套件来保存电子邮件和IMAP客户端::我的IMAP客户端。但是任何语言都应该有可用于表示IMAP连接和电子邮件的公共对象。

0

我相信Attachments.me完全是这样 - 这是否有帮助,或者您的需求仍未得到满足?

0

应该可以从提取器中获取电子邮件ID,然后使用google apps脚本GmailAttachment对象获取附件。