How to extract email's attachments

cancel
Showing results for 
Search instead for 
Did you mean: 
zlucy82
Active Member II

How to extract email's attachments

Hello everyone,
is it possible (in Alfresco 5.2 witdh sdk3) to extract email's attachments from the nodes that are emails (for example .msg files)? I've read the documentation to create custom metadata extractors, but I can not figure out if I can extract attachments as well. Also, if the above point were possible, could such attachments become custom properties (metadata) of the node? Thanks a lot.

6 Replies
roberto_gamiz
Established Member II

Re: How to extract email's attachments

Hello,

You could encapsulate the code to make the file extraction from the "msg" content inside a custom action.

https://docs.alfresco.com/5.2/references/dev-extension-points-actions.html

In this action you could upload the extracted files to the repository like new contents and related it to te origonal contetn using a custom aspect with an association.

Then depends on your bussines necesities you will invoke this action from a content action in Share, a script executed in a rule from a space or in a custom behaviour in the content creation.

Regards

idwright
Senior Member

Re: How to extract email's attachments

One option is this: GitHub - deas/contentreich-eml: Contentreich Alfresco RFC822/EML tweaks 

Another option (and I'm not sure how closely this matches your requirement but it might give you a clue.)

The linked code allows you to reply to a message in a site discussion via email and as part of that process extracts any attachments from the incoming message and stores the attachment as a site document

GitHub - malariagen/alfresco-discussions: Customizations to Alfresco Site Discussions 

zlucy82
Active Member II

Re: How to extract email's attachments

Hi, thanks for yours response.
In these days, i found an outlook plugin that copies an email with it's attachments (splitted from message) in an alfresco's folder such an seprated nodes! Now i need to create an an unique node with attachments readable.
Following the roberto.gamiz response, i created a custom aspect with an association field. Then i created an action that attachs (as node's metadata) one o more node to a main node through this aspect . The problem is that these nodes attached aren't clickable and isn't possible open them! The solution proposed by idwright is very helpful but doesn't match my real requirement. So, i thinked to create a folder action that reads all file within a folder (containing email message and it's attachments) and creates one unique node with pdf mimetype that merges the messages and attachments email.
I thought to use itext library and i hope this my idea is successfull.

roberto_gamiz
Established Member II

Re: How to extract email's attachments

Hi Lucy,

You can configure the association form control to render a link to the document details page of the node associated.

<control template="/org/alfresco/components/form/controls/association.ftl">
<control-param name="showTargetLink">true</control-param>
<control-param name="allowNavigationToContentChildren">true</control-param>
</control>

Forms reference | Alfresco Documentation 

Regards

zlucy82
Active Member II

Re: How to extract email's attachments

Thank you so much, this is a great solution!

oodalis
Member II

Re: How to extract email's attachments

Hi i know this is an old treat could you share the outlook plugin your are using in order to accomplished this?.

Thanks in advanced.