No announcement yet.

How to read mail?

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

    Mirth Interface Engineer
    AWS DevOps

  • #2
    We have a commercial extension made specifically for 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.


    • #3
      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 ..

      Mirth Interface Engineer
      AWS DevOps


      • #4
        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.

        //Fetchmail from Gmail
          var props = new;
          props.setProperty("", "imaps");
          var session = new Packages.javax.mail.Session.getInstance(props, null);
          var store = session.getStore();
          store.connect("", "[email protected]", "xxxxxxxxx");
          var inbox = store.getFolder("INBOX");
          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);
"SENT DATE:" + msgs.getSentDate());
"SUBJECT:" + msgs.getSubject());
"CONTENT:" + content);
          var receiveId = UUIDGenerator.getUUID(); 
"incomingMailID : "+receiveId);
          //Database Connectivity
          var time= msgs.getSentDate();
          var con = bp.getContent();
          var sub = msgs.getSubject();
         //global variable declaration
          return sub;

        Mirth Interface Engineer
        AWS DevOps