使用gmail上下文小工具访问附件

我想将一封电子邮件以及附件从Gmail(Google Apps)保存到另一个数据库,以实现类似CRM的function。 但是,根据文档 ,“提取器无法读取电子邮件附件”。 我的问题:是否有可能以某种方式使用电子邮件中的某种类型的标识符(例如EmailTimeExtractor)并使用它来使用IMAP提取附件? 我对环境小工具还不是很熟悉,只是想知道在潜入太远之前我是否有可能做的事情!

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

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 :: Tools套件来保存电子邮件和IMAP :: Client作为我的imap客户端。 但是任何语言都应该有可用于表示IMAP连接和电子邮件的公共对象。

我相信Attachments.me正是这样做的 – 这有帮助,还是你的需求还没有得到满足?

应该可以从提取器获取电子邮件ID,然后使用谷歌应用程序脚本GmailAttachment对象来获取附件。