Mule SMTP - send email with attachment

荒凉一梦 提交于 2019-12-31 04:25:09

问题


I am trying to use Mule 3.3.0 and configure an SMTP Endpoint. The flow can have a File Inbound Endpoint and a SMTP outbound endpoint. Another flow can have a Java class that generates a String content (body of the email) and also creates a CSV file that it will try to push to the SMTP Outbound Endpoint.

Unforutnately it doesn't seem Mule SMTP supports attachment out of the box by simple configuration. I read up in the web and seems one way to do it is write your own transformer. TO be able to send an attachment with an email is quite a basic feature and I am looking forward to hear answers from Mule experts if this is possible by simple configs.


回答1:


It can be done in two ways.

One with Mule configuration

<set-attachment attachmentName="" value="" contentType="" />

Second with Mule API.

org.mule.api.MuleMessage.addOutboundAttachment(String arg0, Object arg1, String arg2) 

or

org.mule.api.MuleMessage.addOutboundAttachment(String arg0, DataHandler arg1)

Hope this helps.




回答2:


To send attachments, add them to the Mule Message outbound attachments.

See addOutboundAttachment in http://www.mulesoft.org/docs/site/3.3.0/apidocs/index.html?org/mule/api/MuleMessage.html



来源:https://stackoverflow.com/questions/19523239/mule-smtp-send-email-with-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!