【问题标题】:Accessing attachments using gmail contextual gadgets使用 gmail 上下文小工具访问附件
【发布时间】:2011-03-18 19:14:46
【问题描述】:

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

【问题讨论】:

  • 附件不是唯一的限制。您也只能使用 gmail-contextual-gadget API 获取邮件正文的前 1,000 个字符

标签: java javascript gmail gmail-imap gmail-contextual-gadgets


【解决方案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 连接和电子邮件的通用对象。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 2015-07-07
        • 2016-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-09
        • 2014-08-13
        • 1970-01-01
        相关资源
        最近更新 更多