Empty email contents for emails with attachments.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Empty email contents for emails with attachments.

R Williams
My problem is: When I process an email with no attachments, the body of the email is stored. When I process an email with attachments, the attachments are properly saved, but an empty file is created in place of the body of the email.

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:pop3="http://www.mulesoft.org/schema/mule/pop3" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:imaps="http://www.mulesoft.org/schema/mule/imaps" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pop3s="http://www.mulesoft.org/schema/mule/pop3s" xmlns:imap="http://www.mulesoft.org/schema/mule/imap" xmlns:email="http://www.mulesoft.org/schema/mule/email" xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp" xmlns:https="http://www.mulesoft.org/schema/mule/https" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:script="http://www.mulesoft.org/schema/mule/scripting" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" version="CE-3.3.0" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/pop3 http://www.mulesoft.org/schema/mule/pop3/current/mule-pop3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd ">
<pop3:connector name="pop3" validateConnections="false" checkFrequency="10000" doc:name="pop3"/>
<expression-transformer name="returnAttachments" doc:name="returnAttachments">
<return-argument evaluator="attachments-list" expression="*"/>
</expression-transformer>
<expression-transformer name="processInputStream" doc:name="processInputStream">
<return-argument evaluator="groovy" expression="payload.inputStream"/>
</expression-transformer>
<file:connector name="fileName2" outputPattern="#[function:datestamp].msg" writeToDirectory="..\EmailStore\outbound" autoDelete="false" streaming="true" validateConnections="true" doc:name="fileName"/>
<file:connector name="fileName" outputPattern="#[header:session:attachmentFilename]" writeToDirectory="..\EmailStore\outbound" autoDelete="false" streaming="true" validateConnections="true" doc:name="fileName"/>
<flow name="POP3Flow" doc:name="POP3Flow">
<pop3:inbound-endpoint host="XX" port="110" user="XX" password="run2it" responseTimeout="10000" doc:name="POP3"/>
<file:outbound-endpoint path="..\EmailStore\outbound" outputPattern="#[function:datestamp].msg" responseTimeout="10000" connector-ref="fileName" doc:name="File"/>
<expression-transformer doc:name="Expression">
<return-argument evaluator="attachments-list" expression="*"/>
</expression-transformer>
<collection-splitter doc:name="Collection Splitter"/>
<expression-filter expression="payload != null" doc:name="Have Payload"/>
<expression-filter expression="payload.name != null" doc:name="Payload name exists"/>
<message-properties-transformer scope="session" doc:name="Message Properties">
<add-message-property key="attachmentFilename" value="#[groovy:payload.name]"/>
</message-properties-transformer>
<logger level="INFO" doc:name="Logger"/>
<logger message="Email attachment name: #[header:session:attachmentFilename]" level="INFO" doc:name="Logger"/>
<file:outbound-endpoint path="..\EmailStore\outbound" outputPattern="#[header:session:attachmentFilename]" responseTimeout="10000" transformer-refs="processInputStream" connector-ref="fileName2" doc:name="File"/>
</flow>
</mule>