如何删除电子邮件到电子邮件流程中的附件?

How do you remove Attachements in an email to email flow?

我试图删除一个附件,以便我的出站电子邮件仅包含有效负载。我使用了附件转换器,但即使我使用“*”作为过滤器,附件仍在发送。我已将它放在入站和出站端点上,但附件仍然出现在电子邮件中

 <remove-attachment attachmentName="&quot;*&quot;" doc:name="Attachment"/>


<flow name="ocr_app_testFlow">
    <pop3:inbound-endpoint host="mail.awh.com.au" user="knaufack" password="ocr123" responseTimeout="10000" doc:name="POP3"/>
    <logger message="#[message.inboundProperties.subject]" level="INFO" doc:name="Logger"/>
    <remove-attachment attachmentName="*" doc:name="Attachment"/>
    <choice doc:name="Choice">
        <when expression="#[wildcard('*Succeeded*',message.inboundProperties.subject)]">
            <set-variable variableName="Subject" value="#[message.inboundProperties.subject]" doc:name="Variable"/>
            <set-variable variableName="Warehouse" value="#[message.inboundProperties.subject.substring(40,43)]" doc:name="Variable"/>
            <set-variable variableName="Order" value="#[message.inboundProperties.subject.substring(44,51)]" doc:name="Variable"/>
        </when>
        <otherwise>
            <set-variable variableName="Subject" value="#[message.inboundProperties.subject]" doc:name="Variable"/>
            <set-variable variableName="Warehouse" value="#[message.inboundProperties.subject.substring(37,40)]" doc:name="Variable"/>
            <set-variable variableName="Order" value="#[message.inboundProperties.subject.substring(41,48)]" doc:name="Variable"/>
        </otherwise>
    </choice>
    <logger message="#[flowVars.Order] from #[flowVars.Warehouse]" level="INFO" doc:name="Logger"/>
    <set-payload value="Your Order #[flowVars.Order] from #[flowVars.Warehouse] Warehouse is imported succesfully. Please Verify" doc:name="Set Payload"/>
    <remove-attachment attachmentName="*" doc:name="Attachment"/>
    <choice doc:name="Choice">
        <when expression="#[flowVars.Warehouse  == 'ROC']">
            <smtp:outbound-endpoint host="mail.awh.com.au" user="tupload" password="upload123" to="tupload@awh.com.au" from="AWH_Logistics_Integration" subject="AWH OCR Process Notification" responseTimeout="10000" doc:name="ROC Warehouse"/>
        </when>
        <otherwise>
            <smtp:outbound-endpoint host="mail.awh.com.au" user="tupload" password="upload123" to="pauldominguez@awh.com.au" from="AWH_Logistics_Integration" subject="AWH OCR Process Notification" responseTimeout="10000" doc:name="SMTP"/>
        </otherwise>
    </choice>
</flow>
  1. 将附加的转换器 class 添加到您的项目中。

package org.awh.pfinder;

import org.mule.transport.email.transformers.ObjectToMimeMessage;

public class RemoveAttachmentTransformer extends ObjectToMimeMessage {
    
    public RemoveAttachmentTransformer() {
        super();
        setUseInboundAttachments(false);
    }

}

  1. 添加一个 SMTP 连接器并将该转换器设置为出站转换器: