How to append e-mail subject to attachments while downloading to local drive in Mule3.2.1

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

How to append e-mail subject to attachments while downloading to local drive in Mule3.2.1

Sesharao Nuthanki
This post has NOT been accepted by the mailing list yet.
Hi All,

Can you please share your ideas to append e-mail subject to attachments while downloading e-mail attachments to local drive?

Below you can find mule configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:file="http://www.mulesoft.org/schema/mule/file"
      xmlns:imaps="http://www.mulesoft.org/schema/mule/imaps"
      xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
      xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
      xsi:schemaLocation="
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
      http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.2/mule-file.xsd
      http://www.mulesoft.org/schema/mule/imaps http://www.mulesoft.org/schema/mule/imaps/3.1/mule-imaps.xsd
      http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.2/mule-quartz.xsd">

    <description>
        Contain flows to read e-mail attachments and process them using a cron job.
    </description>

    <context:property-placeholder location="esb.properties"/>


    <imaps:connector name="IMAPs" mailboxFolder="Inbox" validateConnections="false" checkFrequency="120000"
                     deleteReadMessages="true" moveToFolder="Processed">
        <imaps:tls-client path="*" storePassword="*"/>
        <imaps:tls-trust-store path="*" storePassword="*"/>
    </imaps:connector>

    <expression-transformer name="returnAttachments">
        <return-argument evaluator="attachments-list" expression="*.xml" optional="true"/>
    </expression-transformer>

    <file:endpoint
            name="fileConnector"
            path="C:\input"
            pollingFrequency="5000"
            doc:name="File"
            responseTimeout="10000"
            fileAge="500"
            comparator="org.mule.transport.file.comparator.OlderFirstComparator"/>

    <flow name="EmailAttachmentsToLocalDrive">
        <imaps:inbound-endpoint user="${mail.user}" password="${mail.password}" host="${mail.host}"
                                        port="${mail.port}" transformer-refs="returnAttachments" disableTransportTransformer="true"/>
        <collection-splitter/>
        <file:outbound-endpoint path="C:\input" outputPattern="#[groovy:payload.name]"/>
    </flow>
</mule>

I wanted to append mail subject to outPutPattern, for example outputPattern="#[message.inboundProperties.subject]_#[groovy:payload.name]".

but this is not working in Mule-3.2.1.


Thanks,
Sesharao.
-Sesha Rao.Nuthanki