Page 1 of 1

Recommendation/sample how to download/filter and store eMail Attachement

PostPosted:Sun Nov 10, 2019 1:30 pm
by OpaHeinz
Hello together

I would like to scan all my eMail Inboxes by filtering the sender and if the mails have an attachment like an invoice.
Also I think, I will need more then one rule to filter the mails.
After that I would like to process the attachment only by OpenKM (Community 6.3.) and set the mail as readed.

In my opinion are two possible way's
a) use an separate process by fetchmail and scripts to store the attachments in a share, which OpenKm will import it later to processing
b) use OpenKm scripting directly
For both I have to start from scratch to understand and implement. :roll:

Out of this:
What would be easier? / are there experience?
Perhaps, has someone a running solution?
Any hints, tips and solutions are welcome!
Thank you in advance :D
rgds
OpaHeinz

Re: Recommendation/sample how to download/filter and store eMail Attachement

PostPosted:Wed Nov 13, 2019 10:36 pm
by jllort
First, what kind of email account do you have ? the best scenario for it should be IMAP, do you have IMAP?
Will you use only a single email account, no? and everything what incoming will be invoices etc.. is that the scenario?

Re: Recommendation/sample how to download/filter and store eMail Attachement

PostPosted:Fri Nov 15, 2019 4:54 pm
by OpaHeinz
I can access it by IMAP and POP3
I would start with one eMail account, later on a second should be included
I get a lot of different mails and contents, so I need to define filter criteria, from which* mail I have to take the attachments.
* = expect multiple rules, different sender and which keywords/ content.

thank you in advance
rgds
OpaHeinz

Re: Recommendation/sample how to download/filter and store eMail Attachement

PostPosted:Sun Nov 17, 2019 11:02 pm
by jllort
1- I suggest always IMAP
2- My second suggestion is not applying any kind of filter from email account, copy all the documents into the same incoming ( one for each email account ).
3- Arrived here you have two options Automation -> process with event-based in Mail creation, or CrontabTask ( I suggest the second, probably you will have fewer problems ).
4- During the email processing you should consider having a log ( for a daily report ) -> what has gone right and what has failed ( move wrong emails to failure folder for manual processing ). You can execute a daily report ( also crontab ) based in the information you have set in a log table ( you may create your own log table for its purpose ).

Some links you should read:
https://docs.openkm.com/kcenter/view/ok ... b-job.html
https://docs.openkm.com/kcenter/view/ok ... ption.html ( Mail and LegacyDAO )