My goal is to read emails(and possibly mark them as read in the inbox) through Mirth Connect channels. I found this Reading mail from open source Mirthconnect question about the issue. Oddly the person asking answered the question. When I tried to implement the code he provided with my specifications such as instead of gmail outlook inbox(no problems here) the channel called out error:
64DETAILS:
TypeError: Cannot find function getBodyPart in object <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi!</div>...(here the email continues with div tags)
So I clearly get the email data but getBodyPart breaks it. What I understood from this is that his code was meant for specific kind of emails and I guess I received an non-mime email in the example here.
So it seems what I am asking: How do I create a reader that translates all mail into plain text and then output it into the logger/other output so I can manage it?
Management would mean something like spreading specifically titled mail into different channels and mark them read in the inbox they came from.
I hope I'm clear enough with my question and follow the rules of asking questions.
I am answering to your updated query.This program will be reading the email repeatedly as you mentioned is correct so as to avoid this after reading you need to move the email to other folder and also you can customise your program to read from particular email sender or based on subject so that it reads only your particular email and you can move that email to you wished folder.