By Anirban Sen Chowdhary
Have you ever wondered you can send mail from Mule application with
attachment
Yes .. We can .. I will show you this trick .. How ??
We need attachment component in Mule to attach any files with
current payload
Let us we have following Mule flow:-
Here you can see we are using Groovy component to design the email body content
in HTML format and that is followed by the Attachment component which will attach
a file with the current message payload and will be send as a mail by the SMTP
component
The corresponding Mule flow will be as follows:-
You can see here Groovy component has designed the payload in HTML content and
Attachment component has picked the file1.txt from it’s location and finally both the
content and the attachment is send as mail by SMTP component
Now we will be hitting our url http://localhost:8081/attachment on the browser
to start the flow and we will get the following on log :-
You can see in the log that email has been dispatched
We will be checking our mail box and will find the following :-
You can see the mail has arrived 
If you open the mail, you will find the content of the mail is designed in HTML
format and the mail contains the attachment
In my next slide I will bring some other techniques in Mule
implementation .
Hope you have enjoyed this simpler version.
Keep sharing your knowledge and let our Mule community grow 
Sending mail with attachment

Sending mail with attachment

  • 1.
    By Anirban SenChowdhary
  • 2.
    Have you everwondered you can send mail from Mule application with attachment
  • 4.
    Yes .. Wecan .. I will show you this trick .. How ??
  • 5.
    We need attachmentcomponent in Mule to attach any files with current payload
  • 6.
    Let us wehave following Mule flow:- Here you can see we are using Groovy component to design the email body content in HTML format and that is followed by the Attachment component which will attach a file with the current message payload and will be send as a mail by the SMTP component
  • 7.
    The corresponding Muleflow will be as follows:- You can see here Groovy component has designed the payload in HTML content and Attachment component has picked the file1.txt from it’s location and finally both the content and the attachment is send as mail by SMTP component
  • 8.
    Now we willbe hitting our url http://localhost:8081/attachment on the browser to start the flow and we will get the following on log :- You can see in the log that email has been dispatched
  • 9.
    We will bechecking our mail box and will find the following :- You can see the mail has arrived 
  • 10.
    If you openthe mail, you will find the content of the mail is designed in HTML format and the mail contains the attachment
  • 11.
    In my nextslide I will bring some other techniques in Mule implementation . Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow 