Reciving and Reading an Email

Hi WmUsers !!!

          Got a small question ;). I am very much able to send mails from my IS. But how do i RECIVE AND READ THE CONTENTS OF THE MAIL ????????  

I know its possible… but how do i do it ??

Can any body just brief me about that ??? <urgent>

Thanks in Advance
Junior Wm User.

Shan,

You will need to configure an email listener on the IS. The listener can invoke a service for each attachment or one for the entire email. The latter will allow you to parse the MIME yourself using the built-in services.

HTH,
Jordy

Hi Jordy !

Thanks for the Immediate Reponse.I have created an email Listner on the IS.

Now how do i start ? from where ?? to parse the mail ??? ah ??
how do i use the getTransportInfo() ??? this is where i land in confusion…
plz bear with me … since i am totally beginner to WM.

Thanks in Advance !
Junior Wm User.
Shan.K.S

Shan,

Please Dont cross the posts…you have posted the same question in other thread too few days back and posted responses by us…

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.

Make sure everything is set.

HTH,
RMG.

Hi,

Here are the steps to be followed.

  1. specify variable inputstream of object type in Input/Output section.

  2. invoke getTransportInfo as the first step.

  3. invoke streamToString from WmSamples package to convert the email stream to string.

  4. use this string to process.

Regards,
kalyan

hi
when i’m using getTransportInfo, save pipeline
i would get only the http transport info
how could i get the smtp transport info
i’m using imap type

Your early help is appreciated

It should have Email port headers info,please check the pipelineout of that service.

RMG–

i’ve checked that, even though it’s only giving http results

"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. "

After call getTransportInfo I call

pub.io:streamTobytes passing “transport/email/content” as input to this service. I get following exception in IS log - I am stuck and need urgent help - thanks!

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

Can you kindly post the solution for this issue for extracting body of the message only in email? I am encountering the same error, in the contentStream variable, it says ‘java.io.ByteArrayInputStream’ as string instead of the stream object,
When trying to use StreamToBytes followed by BytesToString, I am encountering the class cast exception,

Thanks in advance, this is very urgent,

regards,
Chitra

in pipeline of the email processing service, IS will give you either:
contentStream
or
ffdata
both are object type, you can use:
pub.mime:createMimeData

then in mimeData, you got:
mimeData/part/content
this content is Stream, use pub.io:streamToBytes to get the body of the email.

Its not inputstream. It’s contentStream. This must be placed in the service input variable stack.

The getTransportInfo doesn’t do anything it only says the input variables of the service it’s an info service not one for actual content retrieving.

To actually get something useful out of it one must pass it’s contents to MIME object from there you can extract body part, attachments, etc! This is achieved recurring to the get… functions on the WMPublic MIME folder read the manual (built in functions :)) for further instructions.

Connect (contentStream ↔ input [createMIMEData]).

Kaylan I’m complementing your info so that future readers get the problem solved quicker.

Cheers,

Hi RMG,

I’m working on a similar project and I tried the steps as per you suggested. When I try to extract the content of the email, I get much more extra junk characters along with the content. Is there a way to get exactly just the content of the email?

Appreciate your help as always!

Thanks,
Himanshu

Check this:
To actually get something useful out of it one must pass it’s contents to MIME object from there you can extract body part, attachments, etc! This is achieved recurring to the get… functions on the WMPublic MIME folder read the manual (built in functions :)) for further instructions.

If you need further help I think I still have the package where I did this (have to check) I can email it to you.

Cheers,

Thanks for your reply Luis!

I’m still trying to figure it out. If you don’t mind, please send me the package that you may have. It will be greatly helpful. My email address is: hpurandare@gmail.com

Thanks for your help.

Thanks,
Himanshu

i am getting error as ,Failed to start EmailListener:pop3:xxxxxx@gmail.com:25: [ISS.0070.9003] Enable failed: Could not log into account xxxxx@gmail.com. while create new port on IS Admin.

could you please help here any one on this…

Hi chitrag,

Did u get the solution. I am facing the issue myself.

Thanks
Preethi