[ 
https://issues.apache.org/jira/browse/CONNECTORS-1409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969232#comment-15969232
 ] 

Furkan KAMACI commented on CONNECTORS-1409:
-------------------------------------------

Currently, we run that code:

{code:java}
      final Multipart mp = (Multipart) msg.getContent();
      final int numAttachments = mp.getCount();
      for (int i = 0; i < numAttachments; i++) {
          activities.addDocumentReference(documentIdentifier + ":" + i);
      }
{code}

However, e-mail is also a part of Multipart apart from its attachments. So, we 
process them twice. We should decide whether a part is attachment or not. [Q: 
How do I find the attachments in a 
message?|http://www.oracle.com/technetwork/java/faq-135477.html#attachments]

{quote}
Attachments will usually, but not always, have a Content-Disposition of 
attachment. Attachments will usually, but not always, have a file name.

So, a good approach to start with is to only consider messages with a top level 
multipart/mixed content and then consider the parts after the first part to be 
attachments whether they say so or not. 
{quote}

I've tested it and e-mail is always at first part. Attachments comes after 
that. My solution followed that approach. [[email protected]] can you 
comment on this, whether do I miss any cases? Does my understanding is correct 
about attachments always comes after first part?

> Avoid Re-processing Emails
> --------------------------
>
>                 Key: CONNECTORS-1409
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1409
>             Project: ManifoldCF
>          Issue Type: Bug
>          Components: Email connector
>    Affects Versions: ManifoldCF 2.6
>            Reporter: Furkan KAMACI
>            Assignee: Furkan KAMACI
>             Fix For: ManifoldCF 2.7
>
>         Attachments: CONNECTORS-1409.patch
>
>
> Currently, we process e-mails twice which have attachments. We should avoid 
> it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to