| Author | 
		  Message
		 | 
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:15 am    Post subject: Dynamically reading files and emailing them as attachments | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				Hello,
 
 
   I'm working on a scenario where-in i have to dynamically read the Email To,From,Subject,Body,  number of attachments, name of attachments from the XML, go to the shared folder, and email them.
 
 
 Here is my flow :
 
 
 
  MQInput --> Compute --> FileRead --> Compute1 --> EmailOutput
 
 
I'm able to dynamically send emails with single attachment. 
 
If there are 3 Attachment Names in the XML, i'm able to dynamically read the 3 files, BUT, sending 3 emails.
 
 
 Environment : WMB 7.0.0.2 on Windows
 
 
 Any advice will be highly appreciated. 
 
 
thank you,
 
RP | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:30 am    Post subject: Re: Dynamically reading files and emailing them as attachmen | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| rpemmaraju wrote: | 
   
  
	|  Any advice will be highly appreciated.  | 
   
 
 
 
Build the 3 emails you need to send one at a time. Send them to the EMailOutput node. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | dilse | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 24 Jun 2004 Posts: 270
  
  | 
		  
		    
			  
				From his statement I am getting a feeling that he wants to send only one email with three attachment instead of three separate emails.
 
 
OP, clarify what you want to achieve. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:46 am    Post subject: Re: Dynamically reading files and emailing them as attachmen | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| Vitor wrote: | 
   
  
	
 
Build the 3 emails you need to send one at a time. Send them to the EMailOutput node. | 
   
 
 
 
Vitor,
 
 
thank you for your quick response.
 
 
I need to send, in the example scenario, the 3 files as 3 attachments in one email to a list of receipients.
 
 
thank you,
 
RP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| dilse wrote: | 
   
  
	| From his statement I am getting a feeling that he wants to send only one email with three attachment instead of three separate emails. | 
   
 
 
 
Yes, that is a valid interpretation of the post isn't it?    _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:49 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| dilse wrote: | 
   
  
	From his statement I am getting a feeling that he wants to send only one email with three attachment instead of three separate emails.
 
 | 
   
 
 
 
 dilse,
 
 
 Yes. That is the requirement.
 
 
 Thank you,
 
 RP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 8:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				You could use collector.
 
 
You could use Propagate and a LocalEnvironment override to tell FileRead where to put the data it reads (it *does* support that, doesn't it?) so that it puts it in a different place in the message tree each time it reads it.
 
 
A few other options, probably, to assemble the contents of the three files into the same logical message tree. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 9:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	 You could use collector.
 
You could use Propagate and a LocalEnvironment override to tell FileRead where to put the data it reads (it *does* support that, doesn't it?) so that it puts it in a different place in the message tree each time it reads it.
 
 
A few other options, probably, to assemble the contents of the three files into the same logical message tree. | 
   
 
 
 
 Thank you mqjeff for your suggestions.
 
 I have been trying to see if the following works:
 
 
MQInput --> Compute (out terminal) --> FileRead --> Compute2
 
                                 Compute (out1 terminal)  --> Compute1 --> EmailOutput
 
 
I'm looping through and trying to save the 3 Attachments  in Environment in Compute2, retrieve them in Compute1 and Email.
 
 
  For some reason, im getting email with just one attachment which cannot be opened.
 
 
 I will keep working on it and keep you posted and/or come post a request for advice.
 
 
 thank you,
 
 RP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | WGerstma | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 10:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 18 Jul 2011 Posts: 55
  
  | 
		  
		    
			  
				You could also use the FlowOrder Node.
 
 
To its first Terminal you put a Compute which propagates n times to a FileRead and than use a compute to put the read files to environment.
 
 
In the second Terminal, you use a compute to move the files from environment to the message tree and pass it to the Mail Node. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 10:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| WGerstma wrote: | 
   
  
	You could also use the FlowOrder Node.
 
  | 
   
 
 
 
MQInput --> Compute (out terminal) --> FileRead --> Compute2 
 
Compute (out1 terminal) --> Compute1 --> EmailOutput 
 
 
 
 Iam accomplishing the same using Compute node and propagating to 'out' terminal for reading the file(s) using FileRead node and storing them in Environment.Vars.Files[] in Compute2; 
 
Compute node will propagate to Compute1 using 'out1' terminal after reading all the files;
 
 
Now, in Compute1, 
 
iam populating OutputLocalEnvironment.Destination.File.Name based on number of files and iam setting the following properties(leaving couple of properties to default values) on the EMail output node:
 
 
Attachment Content : $Root 
 
 
Attachment Content Type :text/html
 
Attachment Content Encoding : base64:Encoding for binary data
 
Multipart Content Type : All MIME body parts should only be considered in the aggregate 
 
 
thank you,
 
RP | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 1:42 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
 
You could use Propagate and a LocalEnvironment override to tell FileRead where to put the data it reads (it *does* support that, doesn't it?) so that it puts it in a different place in the message tree each time it reads it.
 
 | 
   
 
 
 
Hello mqjeff,
 
 
 I have 3 files in LocalEnvironment.Vars.Files[].
 
 
Now, how do i attach 3 files ? Could not find any relevant info with regards to sending multiple attachments in InfoCenter:
 
 
[url] http://127.0.0.1:58984/help/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac66340_.htm [/url]
 
 
 
Any suggestions ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | marko.pitkanen | 
		  
		    
			  
				 Posted: Thu Aug 04, 2011 9:48 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Chevalier
 
 Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland 
  | 
		  
		    
			  
				Hi,
 
 
I think you should try to create following structure for all your attachments to the OutputLocalEnvironment before forwarding message to EmailOutput -node.
 
 
Sorry the pseudo code (not tested).
 
 
 
   
	| Code: | 
   
  
	
 
CREATE FIELD OutputLocalEnvironment.Destination.Email AS rEmail;
 
--for all your attachments
 
CREATE LASTCHILD OF rEmail AS rAttachment NAME 'Attachment';
 
rAttachment.ContentName = 'Filename';
 
rAttachment.ContentType = 'text/xml';
 
rAttachment.Content = getAttachmentAsBLOB();
 
 | 
   
 
 
 
--
 
Marko | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rpemmaraju | 
		  
		    
			  
				 Posted: Fri Aug 05, 2011 8:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Oct 2006 Posts: 9 Location: Detroit, Michigan, U.S.A 
  | 
		  
		    
			  
				
   
	| marko.pitkanen wrote: | 
   
  
	
 
I think you should try to create following structure for all your attachments to the OutputLocalEnvironment before forwarding message to EmailOutput -node.
 
 | 
   
 
 
 
 Thank you Marko. It worked ! 
 
 
 Regards,
 
 RP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |