Access attachments using gmail gadgets

I would like to save the email along with the attachments from Gmail (Google Apps) to another database for CRM-like features. However, according to docs , "Extractors cannot read email attachments." My question is: is it possible to somehow use some kind of identifier from email (e.g. EmailTimeExtractor) and use it to pull in attachments using IMAP? I am still not very familiar with contextual gadgets and just want to know if what I am trying to do is possible before diving too far!

+5
source share
3 answers

If you use the standard imap client to pull out the email, you will receive an attachment. This will be one of the parts. Psuedo Code:

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
    }
  }
}

When I did this, I wrote it in Perl, so I used the MIME :: Tools suite to store email and IMAP :: Client as my imap client. But any language should have common objects to represent IMAP and email connections.

+1
source

I believe Attachments.me does just that - does it help, or is your need still unmet?

0
source

It should be possible to get the email id from the extractor and then use the google apps script GmailAttachment to receive the attachment.

0
source

All Articles