cancel
Showing results for 
Search instead for 
Did you mean: 

Seperating an email attachment from .eml file

jollymon
Champ in-the-making
Champ in-the-making
How can I extract an pdf document from an .eml file?
9 REPLIES 9

sselvan
Champ in-the-making
Champ in-the-making
I hope you could get an answer in one of my previous post - http://forums.alfresco.com/en/viewtopic.php?f=3&t=25235&start=0&st=0&sk=t&sd=a

hope this helps!

jollymon
Champ in-the-making
Champ in-the-making
Unfortunately I think I might have been bypassing the email alias system for receiving an email by how I configured the IMAP and this might be handling the .eml message as just a file moved into alfresco as a thunderbird rule, and not treating the share folder as an inbox itself. I am unsure and any input would be greatly appreciated.

Thanks

mrogers
Star Contributor
Star Contributor
If you are using the IMAP interface then it is able to split out attachments.   So if your .eml file contains a psd. the email should be split out as a related document.

jollymon
Champ in-the-making
Champ in-the-making
Thanks for the help on this, Ill hit the stumbling block I encountered in case amnyine else is reading this scratching their head.

Once you have the imap working you can enable in the alfresco-global config file to enable automatic seperation of attachments.

All is working well now.

fpp
Champ in-the-making
Champ in-the-making
Could you provide more details on what you mean by enabling the IMAP interface. Are you sending / receiving the emails through Alfresco or are you uploading them e.g. via Share or CIFS?

What I've seen so far (for the uploading) you get into troubles within the normal DM libraries when you are running the DoD / RM module(s) as record management installs a special eml extractor that has the functionality (splitting emails - attachments) but also sets some RM properties / aspects for the files. This means that you can then not use those documents outside the fileplan anymore.

fpp
Update:
found the property for the alfresco-global.properties IMAP setup (imap.server.attachments.extraction.enabled=true)
but unfortunately it still does not split off the email attachments

jollymon
Champ in-the-making
Champ in-the-making
I'm not certain how alfresco is seeing the transfer. From what I am doing I think its inappropriate transfer. Basically I'm running Thunderbird with. Imap connections to alfresco and have another account setup in Thunderbird receiving speific files and have Thunderbird rules setup to transfer the email over into a specific share. I do have rm running and dm installed also. Once I enabled that string in properties it allowed emails to be split up into an eml file and then it creates a folder and extracts the pdf into it. I'm looking to create a rule that reads Meta off the pdf and creates a file structure based on that metadata in a versionable fashion.

Problem. I cannot delete files that have been brought into alfresco now. Is that part of rm or dm module?

fpp
Champ in-the-making
Champ in-the-making
I've seen a problem with deleting files in the document libs (outside of the RM fileplan) when you run the RM on the same repository. Even as admin you can then not delete the email file(s). This problem with deleting files seems to be related to RM - have a look at the properties etc of the files with the node browser. The ones I had the problems with all had some RM properties etc seemingly from the eml extractor RM module.

I'm currently rebuilding our project with the 3.3 dev version (Head) and without the RM on the same repository - seen some note in JIRA that the attachment splitting was turned off because of the rm module. Now the question that remains is how to turn it back on.

fpp

richard_im
Champ in-the-making
Champ in-the-making
This is confirmed and I've issued a jira for this:
https://issues.alfresco.com/jira/browse/ALF-2487

richard_im
Champ in-the-making
Champ in-the-making
I've managed to delete the .emls using a search and remove fileplancomponent aspect:

var emlNodes = search.savedSearch("workspace://SpacesStore/d295c8dd-9f04-4047-9210-31d00d52bd23"); // I am using a saved search where I search for *.eml of mimetype EMail

for (var i=0; i < emlNodes.length; i++) {
  var emlRecord = emlNodes[i];
  emlRecord.removeAspect("{http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent");
  if (!emlRecord.isVersioned) {
    emlRecord.remove();
  }
}



I went through a few iterations so I'm not sure if this is the one that worked or not, but you can debug through it to see if it works for you.  As always, make back ups of your data and test first.  I'd be weary to do this on a production system with out a QA Cycle on your data.

I had trouble getting this to work for versioned .eml because I believe I removed the fileplancomponent before realizing it had versions Smiley Sad