Getting email message body in the flow service???

I want to get the body of the email message (not the attachment) in my flow service. I have configured a port and it is connected to exchange server and everything looks okay. I send email to the given user and my flow service is invoked. If I save the pipeline to the file I see the email message in that.

Following is the pipeline of my saved file

<?xml version="1.0" encoding="UTF-8"?> d:/tmp/Ammad/processEmail_pipeline.xml Initialized initialized
<record name="transport" javaclass="com.wm.util.Values">
  <value name="protocol">email</value>
  <record name="email" javaclass="com.wm.util.Values">
    <value name="subject">Fax: Tx NOT 'ok' Report</value>
    <value name="contenttype">text/plain;
    <value name="sentdate">Thu May 15 16:41:07 EDT 2008</value>
    <array name="from" type="value" depth="1">
      <value>Ammad Amjad <></value>
    <array name="to" type="value" depth="1">
      <value>victorsdevmail <></value>
    <array name="replyto" type="value" depth="1">
      <value>Ammad Amjad <></value>

The prblemm is I can not read the boxy of the message which has been underlined and made italic above.

Please let me know how can I read those values in some variable of pipeline so that I can parse and process as required for the business.

Please remember the email does no have any attachment and I want to just read the email body message.

Any help is greatly appreciated.


Pls refer all threads before posting a new thread…

Anyways check these links,and make sure your email port settings are correct, and you have to extract the email body content(Stream).

Use debugging in the receiving flow service so first step would be getTransportInfo (no inputs needed)and nextstep is savepipelineToFile.Trigger an email via configured port and later use restorepipelineToFile and check the pipeline you should see the getTransportInfo/Email/content and all the other email headers like from,To,subject,contenttype etc…

So extract the content of the email body use these built-in services,pub.string:bytesToString and further down follow upon your requirement.

Thanks responding. I have gone through those already but those posts did not help me as I am getting exception java.lang.ClassCastException: java.lang.String

java.lang.ClassCastException: java.lang.String at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at at at at at at at at at at at at at at com.wm.lang.flow.FlowInvoke.invoke( at com.wm.lang.flow.FlowState.invokeNode( at com.wm.lang.flow.FlowState.step( at com.wm.lang.flow.FlowState.invoke( at at at at

Looks like you are trying to cast a string into a stream object. In your service, look for the step where you’re calling You are probably mapping the wrong variable into that service or maybe you don’t need that service at all (assuming your goal is to convert the stream into bytes and then the bytes into a string.)

  • Percio

Thanks for your responses guys.

I went through different posts but could not succeed in getting email message. Let me tell what I tried


  • called getTransportInfo
  • mapped ‘transport/email/content’ to
  • Got mentioned exception


  • called getTransportInfo
  • called createMimeData and mapped ‘transport/email/content’ to input
  • called getBodyPartContent passing 0 or 1 to ‘index’ - both tried
  • called passing ‘content’
  • content was null - go nothing


  • define a object variable streamContent in the input of the service
  • called createMimeData and map streamContent to input
  • called getBodyPartContent passing 0 or 1 to ‘index’ - both tried
  • called passing ‘content’
  • content was null - go nothing

My goal was to get the body text of the email message. Going through various post in the forums I happened to experiment different things but none worked out for me yet.

It looks like getting email body text is not easy. Please let me know if you know any solution.


Hi Ammad,

I’m trying the similar task and am wondering if you got your’s working?
If yes, can you please share what you had to do to get the content without the extra junk.

Thanks for your help.