2. Have you ever wondered you can send mail from Mule application with
attachment
3.
4. Yes .. We can .. I will show you this trick .. How ??
5. We need attachment component in Mule to attach any files with
current payload
6. 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
7. 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
8. 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
9. We will be checking our mail box and will find the following :-
You can see the mail has arrived
10. If you open the mail, you will find the content of the mail is designed in HTML
format and the mail contains the attachment
11. 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