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;
charset="us-ascii"</value>
    <value name="sentdate">Thu May 15 16:41:07 EDT 2008</value>
    <array name="from" type="value" depth="1">
      <value>Ammad Amjad <aamjad@lendersfc.com></value>
    </array>
    <array name="to" type="value" depth="1">
      <value>victorsdevmail <victorsdevmail@lendersfc.com></value>
    </array>
    <array name="replyto" type="value" depth="1">
      <value>Ammad Amjad <aamjad@lendersfc.com></value>
    </array>
  </record>
</record>

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.

Thanks
Ammad

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).
[URL=“wmusers.com”]wmusers.com
[URL=“wmusers.com”]wmusers.com

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.io:streamTobytes,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

pub.io:streamToBytes java.lang.ClassCastException: java.lang.String

java.lang.ClassCastException: java.lang.String at pub.io.streamToBytes(io.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:403) at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:630) at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:46) at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44) at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:241) at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:51) at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:228) at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:30) at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:621) at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:535) at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:381) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:237) at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:189) at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324) at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581) at com.wm.lang.flow.FlowState.step(FlowState.java:441) at com.wm.lang.flow.FlowState.invoke(FlowState.java:406) at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:1040) at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:630) at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:46) at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsPro

Looks like you are trying to cast a string into a stream object. In your service, look for the step where you’re calling pub.io:streamToBytes. 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

Test-1

  • called getTransportInfo
  • mapped ‘transport/email/content’ to PSUtilities.stream:streamToString
  • Got mentioned exception

Test-2

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

Test-3

  • 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 PSUtilities.stream:streamToString 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.

Thanks
Ammad

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.

Thanks,
Himanshu