0

I'm trying to only pick up emails from a shared mailbox that meet the Subject criteria.

Here is my flow at the moment. It should grab the email, set the attachment as a payload, then save that payload to a file in the resources folder with the original filename for use in a later flow.

<flow name="Retrieve_Email_and_Save_to_Attachments">
    <pop3:inbound-endpoint host="00.00.00.00" user="xxx" password="xxx" connector-ref="POP3" responseTimeout="10000" doc:name="POP3" metadata:id="50f9b85e-6ff6-4b39-9185-75fcd91076a1"/>
    <message-property-filter pattern="subject = 'Test Mule File'" caseSensitive="false" scope="inbound" doc:name="Message Property"/>
    <expression-transformer doc:name="Set Payload from Attachments">
        <return-argument evaluator="attachments" expression="*.*"/>
    </expression-transformer>
    <set-variable variableName="fileName" value="#[payload.keySet().iterator().next()]" doc:name="Set fileName"/>
    <set-payload value="#[payload[flowVars.fileName].getContent()]" doc:name="Set Payload from first Attachment content"/>
    <logger message="#['\n\n']Payload is: #['\n\n'+payload+'\n\n']" level="INFO" doc:name="Logger"/>
    <file:outbound-endpoint path="src/main/resources/attachments/" outputPattern="#[flowVars.fileName]" connector-ref="File" responseTimeout="10000" mimeType="text/plain" doc:name="File"/>
</flow>

The problem I have is that the POP3 connector is picking up all emails in the mailbox regardless of subject line content, deleting them from the server and only processing those that meet the conditions.

Is there a way to only delete the items that pass the filter criteria? Or only pick up the emails that pass the filter criteria?

1 Answers1

0

I think mule doesn't have that feature as per the mule document.

https://docs.mulesoft.com/mule-user-guide/v/3.7/pop3-connector

You can do this by choice.

Retrive the Subject line from the pop3 and perform choice operation and then you can get the wanted suject line emails only.