web stats
Mirth Email Reader - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2014, 07:36 AM
phoff phoff is offline
Mirth Newb
 
Join Date: Aug 2014
Posts: 6
phoff is on a distinguished road
Default Mirth Email Reader

I apologize if this has been answered before but I've searched this site for the answer and even online and have found it. The solution I did find just stated to use the Java mail API but didn't explain.

Can someone, please, point me to directions or tutorial on connecting to a POP3 mailbox, pulling the PDF attachment from the email, saving the PDF to a directory then deleting the email. I would settle just for a tutorial on using the email reader. I can't find this anywhere.

My initial thoughts were the following. I'm new to Mirth too, by the way.
  • Create an Email Reader Channel to connect to mailbox
  • Create a transformer to read the email and extract the PDF
  • Save the PDF data into the channelMap object
  • Set the Destination to FileWriter to write PDF

Obviously, I do not know how to accomplish this so ANY tutorial on using the EmailReader will be very helpful.
Reply With Quote
  #2  
Old 08-27-2014, 07:56 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

By default the Email Reader includes all message data:



That data will be serialized XML. In a transformer, you grab the attachment node (hopefully in Base64 format), and put it in a channel map variable. Then in the File Writer, drag that variable into your template, and make sure to use Binary mode.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 08-27-2014, 08:00 AM
phoff phoff is offline
Mirth Newb
 
Join Date: Aug 2014
Posts: 6
phoff is on a distinguished road
Default

thanks for the very quick answer. I wasn't expecting an answer anytime soon.
In your example, you use IMAP and not POP3. why?
Reply With Quote
  #4  
Old 08-27-2014, 08:02 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by phoff View Post
thanks for the very quick answer. I wasn't expecting an answer anytime soon.
In your example, you use IMAP and not POP3. why?
Those are just the default settings.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 08-27-2014, 08:08 AM
phoff phoff is offline
Mirth Newb
 
Join Date: Aug 2014
Posts: 6
phoff is on a distinguished road
Default

Ok. what if I switch to POP3. would the incoming stream be xml still?
Reply With Quote
  #6  
Old 08-27-2014, 08:09 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by phoff View Post
Ok. what if I switch to POP3. would the incoming stream be xml still?
Yep, the protocol doesn't change that.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
attachment, email, pdf

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation