Announcement

Collapse
No announcement yet.

Reading PDF to attach an email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading PDF to attach an email

    Hello,

    We have a channel with several destinations. Last destination is SMTP sender. We need to attach a pdf sitting on the temp folder with filename (accession number.pdf). Although with a different channel we can do a file read at source and sent the pdf but we lose patient information if we do a separate channel.

    Is there a way to grab the pdf and attach this pdf to the mail within the original channel.

    Any help appreciate.

    Haluk Celikel

  • #2
    Yep. In your transformer you can read the file in and store it as an attachment, saving the attachment ID into the channel map:

    Code:
    $c('pdf', addAttachment(FileUtil.encode(FileUtil.readBytes(fileName)), 'application/pdf').getAttachmentId());
    Then in the SMTP Sender Attachments table you can just drag your variable into the Content row:

    Code:
    ${pdf}
    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
      FileUtil?

      Comment


      • #4
        great thank u. I've spent whole day to make it work than it took 15 min to implement. much appreciated.

        Haluk

        Comment

        Working...
        X