Announcement

Collapse
No announcement yet.

How to read mail?

Collapse
X
 
  • 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: 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.

    Comment


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

      Comment


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

        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", "[email protected]", "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

        Comment

        Working...
        X