How to parse inbound e-mail when using Mule's IMAP transport? -
i starting larn mule please forgive me if basic question.
i have configured mule monitor mail service box whenever mail service comes in write mail service text file (just testing).
now need parse mail service , message / / mail.
<flow name="testflow" doc:name="testflow"> <imap:inbound-endpoint host="ip" port="143" user="username" password="pwd" doc:name="imap" responsetimeout="10000" transformer-refs="message_properties"> </imap:inbound-endpoint> <file:outbound-endpoint path="c:\" outputpattern="#[function:datestamp].dat" doc:name="file"> </file:outbound-endpoint> </flow>
i thought able header info using below look (using look transformer)
#[inboundproperties['email-header-name']]
but doesn't seem work. tried below expressions didn't work,
#[map-payload:host] #[map-payload:message] #[map-payload:timestamp]
can help? know if there document list of available expressions?
edit:
i included logger view properties , displayed properties couldnt find body.. also, tried getting fromaddress using
#[map-payload:fromaddress] , #[inboundproperties['fromaddress']]
but didn't work, can allow me know wrong?
the properties below,
inbound.fromaddress=service <service@xx.com> inbound.subject=test final inbound.toaddresses=service
edit 2:
this have tried doesnt work :(
i trying retrieve email subject , write file or show using logger based on email subject getting below error.
error 2013-02-07 19:22:45,275 [[test].connector.file.mule.default.dispatcher.01] org.mule.exception.defaultmessagingexceptionstrategy: ******************************************************************************** message : not find transformer transform "simpledatatype{type=javax.mail.internet.mimemessage, mimetype='*/*'}" "simpledatatype{type=java.io.inputstream, mimetype='*/*'}". code : mule_error-236
can allow me know making mistake?
<flow name="testflow1" doc:name="testflow1"> <imap:inbound-endpoint host="ip" port="143" user="uname" password="pwd" doc:name="imap" responsetimeout="10000" disabletransporttransformer="true"> </imap:inbound-endpoint> <logger message="#[message.inboundproperties['inbound.fromaddress']]" level="info" doc:name="logger"/> <choice doc:name="choice"> <when expression="message.inboundproperties['inbound.subject']=='plain test'"> <processor-chain> <logger message="#[message.inboundproperties['inbound.fromaddress']]" level="info" doc:name="logger"/> </processor-chain> </when> <otherwise> <processor-chain> <file:outbound-endpoint path="c:\mule" outputpattern="#[function:datestamp].dat" responsetimeout="10000" disabletransporttransformer="true" doc:name="file"> </file:outbound-endpoint> </processor-chain> </otherwise> </choice> </flow>
unfortunately imap connector documentation doesn't list message properties created when new message received. can find created properties adding:
<logger level="warn" />
after imap:inbound-endpoint
. log message meta information, including properties, @ warn level.
you can find property names in mailproperties
javadoc. illustration inbound.fromaddress
inbound property contains sender's email address.
the message body text email content, unless it's multi-part email. in case, if first part text/plain
, set message payload, otherwise parts available inbound message attachments.
mule mule-studio
No comments:
Post a Comment