ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Dynamically reading files & emailing them csv as attachm

Post new topic  Reply to topic
 Dynamically reading files & emailing them csv as attachm « View previous topic :: View next topic » 
Author Message
premji
PostPosted: Mon Jan 19, 2015 8:43 am    Post subject: Dynamically reading files & emailing them csv as attachm Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi All,

How can we emailing them csv file as attachment by using Java Compute node.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 19, 2015 8:55 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

By constructing the necessary logical message tree.
Back to top
View user's profile Send private message
premji
PostPosted: Mon Jan 19, 2015 9:00 am    Post subject: Dynamically reading files & emailing them csv as attachm Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi

Thank you for your quick reply. I have tried to build but I am not able to send CSV format file
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 19, 2015 9:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why aren't you?

What did you do to build a CSV format?

What are you using to send an email?
Back to top
View user's profile Send private message
premji
PostPosted: Mon Jan 19, 2015 9:14 am    Post subject: Dynamically reading files & emailing them csv as attachm Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi

I have requirement to send CSV file as attachment, if I converted CSV file to byte code format I can send file but original content I am not able to send as attachment.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 19, 2015 9:20 am    Post subject: Re: Dynamically reading files & emailing them csv as att Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

premji wrote:
I have requirement to send CSV file as attachment


Ok. What steps have you taken to accomplish that requirement?
premji wrote:
original content I am not able to send as attachment.
Why not? What happens?

What steps have you taken, so far?
Back to top
View user's profile Send private message
premji
PostPosted: Mon Jan 19, 2015 10:16 am    Post subject: Dynamically reading files & emailing them csv as attachm Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi

First I have declared as MIME type and Content Type as MIME type.
This below code I have written so far. parts is child of MIME type. Here if I added string value instead of bytes I got exception.


part = parts.createElementAsLastChild(MbElement.TYPE_NAME, "Part", null);
part.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "Content-Type", "text/plain; " +
"charset=us-ascii;name=attachment.xlsx");
part.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "Content-Transfer-Encoding", "8bit");
data = part.createElementAsLastChild(MbElement.TYPE_NAME, "Data", null);
blob = data.createElementAsLastChild("BLOB");

String sourceName= "source file path";
inputStream = new BufferedReader(new FileReader(sourceName));

String l;
while ((l = inputStream.readLine()) != null) {
attachment2Text = attachment2Text + l + "\r\n";
}
blob.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", attachment2Text.getBytes("UTF8"));
inputStream.close();
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Dynamically reading files & emailing them csv as attachm
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.