5

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

4

3 回答 3

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

于 2010-07-28T22:06:46.063 回答
0

我相信 Attachments.me 正是这样做的——这有帮助吗,还是您的需求仍未得到满足?

于 2012-03-29T17:37:51.273 回答
0

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

于 2013-07-02T19:22:00.023 回答