user736893
user736893

Reputation:

Mule: How to capture attachment from IMAP connector?

I have my test flow successfully querying an imap inbox. I'm trying to capture the attachments and save them to an output folder. So far, I haven't had any success. I've played around with the "Attachment" transform as well as copying and pasting the example from the documentation for the IMAP transport. I'm not sure if that example is out of date or what, but I keep getting an error.

Here is the code from the "Configuration Example" in the IMAP docs:

<?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:spring="http://www.springframework.org/schema/beans"
       xmlns:imap="http://www.mulesoft.org/schema/mule/imap"
       xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
       xmlns:file="http://www.mulesoft.org/schema/mule/file"
       xmlns:email="http://www.mulesoft.org/schema/mule/email"
       xsi:schemaLocation="
       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/3.6/mule.xsd
       http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd
       http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/imap/3.6/mule-imap.xsd
       http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/3.6/mule-email.xsd
       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd">

    <imap:connector name="imapConnector"  />

    <expression-transformer name="returnAttachments">
        <return-argument evaluator="attachments-list" expression="*" optional="false"/> ❶
    </expression-transformer>

    <file:connector name="fileName"> 
        <file:expression-filename-parser/> 
    </file:connector>

        <flow name="incoming-orders">
            <imap:inbound-endpoint user="bob" password="password" host="emailHost"
                     port="143" transformer-refs="returnAttachments" disableTransportTransformer="true"/> ❷
            <collection-splitter/>
            <file:outbound-endpoint path="./received" outputPattern="#[function:datestamp].dat"> ❹
                <expression-transformer>
                    <return-argument expression="payload.inputStream" evaluator="groovy" /> ❺
                </expression-transformer>
            </file:outbound-endpoint>                    
        </flow>
</mule>

And here is the error I get (after changing all the connection details):

Element 'expression-transformer' cannot have character [children], because the type's content type is element-only.

Relevant info:



Full output: http://pastebin.com/1EAEbTFw

Upvotes: 0

Views: 824

Answers (1)

afelisatti
afelisatti

Reputation: 2835

I could only get that error using the exact config you provided, because there are weird characters in it, see: ❶ I guess you copy-pasted from the docs site? Those are references within the docs. Removed them and it should work.

Upvotes: 1

Related Questions