web stats
How to read mail? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2015, 01:10 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Red face How to read mail?

Hi guys,
I just have a trouble in this process. I like to read the data from mail, is it possible to acheive this in the open source mirthconnect? of version 3.3.1, if so is it possible to read from direct mail?
Reply With Quote
  #2  
Old 12-21-2015, 06:37 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

We have a commercial extension made specifically for that: https://www.mirth.com/Products-and-S...n=email-reader
__________________
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 12-29-2015, 12:15 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Default javascrit mail reader

We can read mail in non-comercial versions too. We have to deploy the source connector as Javascript and produce the javascript code to read the mail.
I initially wrote the java code to read the mail then provided the IMAP, POP3 jar files in the library, then transformed the complete code to Mirthconnect and provided the sufficient jars inside the Mirth custom-library folder ..
Reply With Quote
  #4  
Old 06-05-2017, 03:56 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Thumbs up JAVA code for Email Reader

Hi Have provided the Java code needed to fetch the mail from your gmail account here. you can use this in the JAVA and create a .jar file. Invoking this Package you can create a channel in Mirth that will read mail on deployment.

Code:
//Fetchmail from Gmail
  var props = new Packages.java.util.Properties();
  props.setProperty("mail.store.protocol", "imaps");
  var session = new Packages.javax.mail.Session.getInstance(props, null);
  var store = session.getStore();
  store.connect("imap.gmail.com", "xxxxxxxx@gmail.com", "xxxxxxxxx");
  var inbox = store.getFolder("INBOX");
  inbox.open(Packages.javax.mail.Folder.READ_ONLY);
  var msgs = inbox.getMessage(inbox.getMessageCount());
  var currentMessage = inbox.getMessage(inbox.getMessageCount());
  var mp = currentMessage.getContent();
  var bp = mp.getBodyPart(0);
  var content = "" + bp.getContent();
  content = content.replace(/''/g, "");
  globalMap.put('gcon', content);
  logger.info("SENT DATE:" + msgs.getSentDate());
  logger.info("SUBJECT:" + msgs.getSubject());
  logger.info("CONTENT:" + content);
  //bp.getContent()  
  var receiveId = UUIDGenerator.getUUID(); 
  logger.info("incomingMailID : "+receiveId);
  //Database Connectivity
  var time= msgs.getSentDate();
  var con = bp.getContent();
  var sub = msgs.getSubject();
 //global variable declaration
  globalMap.put('glcontent',con);
  globalMap.put('glsubject',sub);
  globalMap.put('gltime',time);
  return sub;
__________________

Mirth Interface Engineer
AWS DevOps
Reply With Quote
Reply

Tags
ccda, mail, mirth3.3.1

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 12:17 AM.


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