Author |
Message
|
ginggo |
Posted: Mon Mar 02, 2009 12:26 am Post subject: SendMail Plugin IA07 - Questions about Email Attachment |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
Hi
I am new to SendMail Plugin (IA07). I tried to send email with attachment with this plugin. However, emails could be successfully sent but always without the attachment.
I have configured the outputroot as suggested in the pdf file come with the plugin. What else do I need to configure?
Somebody posted the same question few years ago but there wasn't any definite answer to this.
My ESQL code is as follows:
SET OutputRoot.XML.Message = InputRoot.MRM;
SET OutputRoot.BLOB.BLOB = InputRoot.MRM.EncodingBase64.Data;
SET OutputRoot.XML.Message.EncodingBase64.Data = null;
My input XML is as follows:
<EncodingBase64 ContentType="text/plain" Name="sms.txt" >
<Data>
<![CDATA[PFNNU1JlcXVlc3Q+DQo8QXBwSUQ+QURTPC9BcHBJRD4NCjxNZXNzYWdlPjEyMzQ1Njc4OTA9MTwvTWVzc2FnZT4NCjxNb2JpbGU+ODUyOTY2MDA4NzM8L01vYmlsZT4NCjxUeXBlPmFzY2lpPC9UeXBlPg0KPC9TTVNSZXF1ZXN0Pg==]]>
</Data>
</EncodingBase64>
I have checked in Debug Mode and confirmed that -
1. The ContentType and Name attributes are inside OutputRoot.XML.Message.EncodingBase64
2. OutputRoot.BLOB.BLOB =
PFNNU1JlcXVlc3Q+DQo8QXBwSUQ+QURTPC9BcHBJRD4NCjxNZXNzYWdlPjEyMzQ1Njc4OTA9MTwvTWVzc2FnZT4NCjxNb2JpbGU+ODUyOTY2MDA4NzM8L01vYmlsZT4NCjxUeXBlPmFzY2lpPC9UeXBlPg0KPC9TTVNSZXF1ZXN0Pg== |
|
Back to top |
|
 |
ginggo |
Posted: Mon Mar 02, 2009 12:28 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
|
Back to top |
|
 |
MQEnthu |
Posted: Mon Mar 02, 2009 12:34 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
What is the version of WMB...if it is V6.1 EmailOutput node would be the better choice.. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
ginggo |
Posted: Mon Mar 02, 2009 12:36 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
we are using ver6.0
any workaround for 6.0? |
|
Back to top |
|
 |
ginggo |
Posted: Mon Mar 02, 2009 12:38 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
thanks MQEnthu!
is EmailOutput Node available for 6.0 as well? |
|
Back to top |
|
 |
MQEnthu |
Posted: Mon Mar 02, 2009 12:59 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
ginggo wrote: |
is EmailOutput Node available for 6.0 as well? |
No ... it is one of the new nodes introduced in V6.1... _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
ginggo |
Posted: Mon Mar 02, 2009 1:47 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
thanks...
i could try to update it to 6.1
but anyone here using 6.0 with SendMail plugin? |
|
Back to top |
|
 |
ginggo |
Posted: Tue Mar 03, 2009 8:35 pm Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
I tried to update it to 6.1 and EmailOutputNode
I saw the exception saying "no smtp server found"
but i have set the smtp server in the property page of EmailOutputNode
any idea? |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Mar 03, 2009 11:23 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Have your tried the sample flow that comes with V6.1?
Follow the instructiuons to the letter and you (provided the SMTP Server will allow your connection) get it to work.
I recently had to get the V6.1 nodes working in a customer. There was a catche 22 situation in that they wouldn't let me connect to it unless I could show it working but I couln't connect to demonstrate it. So I downloaded a trial version of Axigen and set that up in a VM. I could demonstrate the connectivity & operation of the Email output. Then once the customer IT dept gave the go ahead, I switched the flow to use the proper one and it works as advertised.
Perhaps you can try this method for yourself. Remember to follow the instructions in the sample to setup your broker and you shouldn't go far wrong.
Finally, if you have problems with your own flow DON'T use the debugger. Add some trace nodes before the emailOutput node. Get a user trace output of ${Root} & ${LocalEnvironment}. Put some trace nodes in the sample flow and see what works and adjust your flow to make it do the same. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
ginggo |
Posted: Wed Mar 04, 2009 6:49 pm Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
i m really new to message broker ...
i find it quite confused with attachments
the input message is a xml.
the file is already encoded with base64 and it is stored in
InputRoot.MRM.Data
how to make the EmailOutput Node convert it back to a correct file attachment?
i tired this
SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(InputRoot.MRM.Data as BLOB CCSID 1208);
SET OutputLocalEnvironment.Destination.Email.Attachment.ContentName = 'abc.gif';
SET OutputLocalEnvironment.Destination.Email.Attachment.ContentType = 'application/octet-stream';
SET OutputLocalEnvironment.Destination.Email.Attachment.ContentEncoding = 'base64';
the attachment appears in the email i received
but it doesn't seem to be a correct file...i couldn't open it successfully with image browser
how should i change this line?
SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(InputRoot.MRM.Data as BLOB CCSID 1208); |
|
Back to top |
|
 |
MQEnthu |
Posted: Wed Mar 04, 2009 8:45 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Is not the the attachment contains normal ASCII text? If yes, use 7bit
Destination.Email.Attachment.ContentEncoding.. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
ginggo |
Posted: Wed Mar 04, 2009 10:46 pm Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
it's a binary file.
i m trying to attach a gif file
do you mean that i should encode the gif file with 7bit first and store inside InputRoot.MRM.Data?
like this?
SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(InputRoot.MRM.Data as BLOB CCSID 1208);
SET OutputLocalEnvironment.Destination.Email.Attachment[1].ContentEncoding = '7bit'; |
|
Back to top |
|
 |
MQEnthu |
Posted: Wed Mar 04, 2009 11:12 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
ginggo wrote: |
it's a binary file.
i m trying to attach a gif file |
You were correct..base64 is the encoding you should use for binary files. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
ginggo |
Posted: Thu Mar 05, 2009 12:35 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
thanks
but the attachment i found in the received email is not correct..
here is what i hv done
1. use some other converter to convert the gif to base64
2. the string (InputRoot.MRM.Data) is passed to the compute node
3. SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(InputRoot.MRM.Data as BLOB CCSID 1208);
4. EmailOutput node.
then i got the email
however, the attached file is still the string encoded with base64
i supposed the EmailOutput node would convert it back to a correct file?
i wonder if my steps are correct. |
|
Back to top |
|
 |
ginggo |
Posted: Thu Mar 05, 2009 1:37 am Post subject: |
|
|
 Novice
Joined: 01 Mar 2009 Posts: 13 Location: Hong Kong
|
at last i tried to do it this way and the attachments work fine now!
SET OutputLocalEnvironment.Destination.Email.Attachment[1].Content = base64Decode(InputRoot.MRM.Data);
CREATE PROCEDURE base64Decode(IN source CHAR)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.javacompute.Base64.decode";
but have to call the built-in java function
thanks everyone again!  |
|
Back to top |
|
 |
|