web stats
Reading PDF to attach an email - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2017, 09:26 AM
haluk haluk is offline
Mirth Newb
 
Join Date: Nov 2015
Posts: 17
haluk is on a distinguished road
Question 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
Reply With Quote
  #2  
Old 08-24-2017, 09:35 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 08-24-2017, 09:35 AM
mcalKno mcalKno is offline
 
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road
Default

FileUtil?
Reply With Quote
  #4  
Old 08-24-2017, 07:45 PM
haluk haluk is offline
Mirth Newb
 
Join Date: Nov 2015
Posts: 17
haluk is on a distinguished road
Default

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

Haluk
Reply With Quote
Reply

Tags
mail, pdf, smtp

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 09:21 AM.


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