• How to extract only attachements of eMails

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #47660  by OpaHeinz
 
Hello together
I used OpenKM Script to import Mails into it. Everything works fine.

But my requirement is, to import only the attachments of my eMail account into OpenKM, into a specific folder.

I thought about a cron job, which connects to my eMail account and takes each night all delivered eMail attachments into an OpenKM Folder.

Did anyone had an idea/experience how to handle this/ similar solution / script, of such a requirement?
?

Thank you in advance
OpaHeinz
 #47672  by jllort
 
Usually this kind of problems are solved into OpenKM in a different manner. Upload the mail with attachment, for your information about the mail creation life cycle. First it is created the mail node without attachments, later are added the attachments, what at the end are standard documents what they have a parent of type Mail.

You should use Automation -> document create event and evaluate when a document parent is an email or not. For example:
1- upload mails into /okm:root/mails
2- set a automation task rule to check documents created into /okm:root/mails and check if they are have a parent of type Mail.
3- in case documents have a parent of type Mail then move these documents where you wish
4- schedule a crontab task to purge mails from /okm:root/mails what will be older of 24h
 #47676  by OpaHeinz
 
Hello Jilort
thank you for replying!

I tried like you suggested, but there is probably a knowledge gap.
I created a rule if a dokument in /okm:root/mails is created
But I am not able to find a solution to check "a parent of type Mail"

Would it be possible to get a little bit more details?

Thank you in advance
rgds
OpaHeinz
 #47680  by jllort
 
Let's go with a sample:
You have an email at
1- /okm:root/mails/Some-Email ( with an attachmed what mean into OpenKM is stored into soemthing like /okm:root/mails/1234-Some-Email/document.pdf ( do not worry about 1234 in front of the path, the reason is to be able to upload several email with same name ))

2- If you create a automation rule based on document creation in path /okm:root/mails/ will be raised the event in document creation /okm:root/mails/1234-Some-Email/document.pdf

Then you only must check if parent of document.pdf is a Mail the steps are:
1- convert uuid to path -> https://docs.openkm.com/kcenter/view/ok ... etNodePath
2- get parent path -> https://docs.openkm.com/kcenter/view/ok ... #getParent
3- check if the parent is an email -> https://docs.openkm.com/kcenter/view/ok ... ml#isValid

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.