SlideShare a Scribd company logo
Send email
attachment using
SMTP in Mule ESB
Presented by : Sreekanth Kondapalli
What is Mule ESB ?
 Mule ESB is a lightweight Java-based enterprise service
bus (ESB) and integration platform that allows
developers to connect applications together quickly and
easily, enabling them to exchange data. Mule ESB
enables easy integration of existing systems, regardless
of the different technologies that the applications use,
including JMS, Web Services, JDBC, HTTP, and more.
 This example shows how we can send email attachment using SMTP connector to
self or another email. We simply put a file in a source directory and Mule will
read the file from the source directory.
 Using Mule ESB it’s very easy to read the file from a location. If we had to read
the file using manual coding then we had to write many lines of code. But using
Mule ESB we just simply put a file in a directory and let the Mule know the file
path and Mule does the rest of the thing. Y
 You can put any kind of file to the source for reading. The file that we put into a
source directory will be an attachment to the intended recipient’s mail address.
So finally when we will see the file as an attachment in the mailbox.
What is Mule ESB ?
What is Attachment
transformer ?
 Attachment transformer lets us attach a file or
document which will be sent to the email address.
What is SMTP connector ?
 The SMTP endpoint allows Mule messages to be sent as
email or email attachments with the Simple Mail
Transfer Protocol (SMTP) using Java mail API.
Prerequisites
 Mule Studio 3.5.1
JDK 1.6
Maven 3
Mule Runtime 3.5.0 CE
Knowledge of XML
 Open Mule Studio and create a mule project. Go to File->New->Mule
Project. Now enter the Project Name, selectRuntime – Mule Server, check
the check box for Use Maven. Now enter the following information
 Group Id: your Mail(ex. gmail.com)
Artifact Id: project name – file-attachment(automatically populated when
project name is getting typed)
V
 Click Next and verify project Location and JRE/JDK are set correctly. Click
Finishersion: Mule studio generates default
 Now drag and drop the elements from right side of the Mule studio as shown
below in the picture.
Browse and select the path from where a file will be read for an attachment.
Logger component properties
 File to String transformer properties
 File-to-Strong transformer just transforms the file object to human
readable string format. We will not set any property for this element
Attachment transformer properties
 Using attachment transformer we can set payload from previous flow as an
attachment. We have to select Content Type, operation as Set Attachment,
Name, Value
 SMTP connector properties
For SMTP connector we have to input email host, user name, password,
port under Basic Settings and To Address, From Address, Subject under
Email Information.
 The whole XML file of entire flow
 <?xml version="1.0" encoding="UTF-8"?>

 <mule xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp"
 xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core"
 xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
 xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
 http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
 http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
 http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd">
 <flow name="file-attachmentFlow1" doc:name="file-attachmentFlow1">
 <file:inbound-endpoint path="D:AnypointWorkspacesource"
 responseTimeout="10000" doc:name="File" />
 <logger message="#[payload]" level="INFO" doc:name="Logger" />
 <file:file-to-string-transformer
 doc:name="File to String" />
 <logger message="#[payload]" level="INFO" doc:name="Logger" />
 <set-attachment attachmentName="attachment" value="#[payload]"
 contentType="text/plain" doc:name="Attachment" />
 <logger message="#[payload]" level="INFO" doc:name="Logger" />
 <smtp:outbound-endpoint host="mail.domain.com"
 user="emailAddress@domain.com" password="password" to="emailAddress@domain.com"
 from="emailAddress@domain.com" subject="Test Email" responseTimeout="10000"
 doc:name="SMTP" />
 <logger message="#[payload]" level="INFO" doc:name="Logger" />
 </flow>
 </mule>
 Now create a text file called file-attachment.txt and put it under selected
path, i.e., as per the above XML the file path is D:AnypointWorkspacesource.
 Do right-click on file-attachment.xml and click on Run As -> Mule Application
with Maven. Once the application up and running you will get the console
output and email attachment in your mailbox where you have sent the email.
 Output in console
 INFO 2015-03-05 09:25:46,372 [[file-attachment].connector.file.mule.default.receiver.01]
org.mule.transport.file.FileMessageReceiver: Lock obtained on file:
D:AnypointWorkspacesourcefile-attachment.txt
 INFO 2015-03-05 09:25:46,404 [[file-attachment].file-attachmentFlow1.stage1.02]
org.mule.api.processor.LoggerMessageProcessor:
org.mule.transport.file.ReceiverFileInputStream@6a150e
 INFO 2015-03-05 09:25:46,406 [[file-attachment].file-attachmentFlow1.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: This is a file content
 INFO 2015-03-05 09:25:46,407 [[file-attachment].file-attachmentFlow1.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: This is a file content
 INFO 2015-03-05 09:25:46,419 [[file-attachment].file-attachmentFlow1.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: This is a file content
 INFO 2015-03-05 09:25:46,422 [[file-attachment].connector.smtp.mule.default.dispatcher.01]
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound
transformer: org.mule.transport.email.transformers.ObjectToMimeMessage
 INFO 2015-03-05 09:25:46,428 [[file-attachment].connector.smtp.mule.default.dispatcher.01]
org.mule.lifecycle.AbstractLifecycleManager: Initialising:
'connector.smtp.mule.default.dispatcher.1213248'. Object is: SmtpMessageDispatcher
 INFO 2015-03-05 09:25:48,878 [[file-attachment].connector.smtp.mule.default.dispatcher.01]
org.mule.lifecycle.AbstractLifecycleManager: Starting:
'connector.smtp.mule.default.dispatcher.1213248'. Object is: SmtpMessageDispatcher
 Click on the attachment. You will see the below output in the browser.

More Related Content

What's hot

ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on Kubernetes
René Cannaò
 
Creating MuleSoft API Template Project Using Maven Archetype
Creating MuleSoft API Template Project Using Maven ArchetypeCreating MuleSoft API Template Project Using Maven Archetype
Creating MuleSoft API Template Project Using Maven Archetype
Manish Kumar Yadav
 
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys MeetupsMuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
Angel Alberici
 
Grafana.pptx
Grafana.pptxGrafana.pptx
Grafana.pptx
Bhushan Rane
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
Sargis Sargsyan
 
Creating modern java web applications based on struts2 and angularjs
Creating modern java web applications based on struts2 and angularjsCreating modern java web applications based on struts2 and angularjs
Creating modern java web applications based on struts2 and angularjs
Johannes Geppert
 
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Jonathan Vila
 
twMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 如何測試與保護你的 web application with playwrighttwMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 如何測試與保護你的 web application with playwright
twMVC
 
Best Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdfBest Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdf
pCloudy
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
Ioan Eugen Stan
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
Amazon Web Services
 
Load Testing with k6 framework
Load Testing with k6 frameworkLoad Testing with k6 framework
Load Testing with k6 framework
Svetlin Nakov
 
Distributed Lock Manager
Distributed Lock ManagerDistributed Lock Manager
Distributed Lock Manager
Hao Chen
 
Hidden automation-the-power-of-gel-scripting
Hidden automation-the-power-of-gel-scriptingHidden automation-the-power-of-gel-scripting
Hidden automation-the-power-of-gel-scripting
Prashank Singh
 
MuleSoft Anypoint Platform and Three Tier Architecture
MuleSoft Anypoint  Platform and Three Tier ArchitectureMuleSoft Anypoint  Platform and Three Tier Architecture
MuleSoft Anypoint Platform and Three Tier Architecture
Harish Kumar
 
TypeScript With Node And Express
TypeScript With Node And ExpressTypeScript With Node And Express
TypeScript With Node And Express
Simplilearn
 
10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration
Coforge (Erstwhile WHISHWORKS)
 
Deep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormationDeep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormation
Amazon Web Services
 
Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)
Brian Brazil
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 

What's hot (20)

ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on Kubernetes
 
Creating MuleSoft API Template Project Using Maven Archetype
Creating MuleSoft API Template Project Using Maven ArchetypeCreating MuleSoft API Template Project Using Maven Archetype
Creating MuleSoft API Template Project Using Maven Archetype
 
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys MeetupsMuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
 
Grafana.pptx
Grafana.pptxGrafana.pptx
Grafana.pptx
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
 
Creating modern java web applications based on struts2 and angularjs
Creating modern java web applications based on struts2 and angularjsCreating modern java web applications based on struts2 and angularjs
Creating modern java web applications based on struts2 and angularjs
 
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
 
twMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 如何測試與保護你的 web application with playwrighttwMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 如何測試與保護你的 web application with playwright
 
Best Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdfBest Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdf
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
 
Load Testing with k6 framework
Load Testing with k6 frameworkLoad Testing with k6 framework
Load Testing with k6 framework
 
Distributed Lock Manager
Distributed Lock ManagerDistributed Lock Manager
Distributed Lock Manager
 
Hidden automation-the-power-of-gel-scripting
Hidden automation-the-power-of-gel-scriptingHidden automation-the-power-of-gel-scripting
Hidden automation-the-power-of-gel-scripting
 
MuleSoft Anypoint Platform and Three Tier Architecture
MuleSoft Anypoint  Platform and Three Tier ArchitectureMuleSoft Anypoint  Platform and Three Tier Architecture
MuleSoft Anypoint Platform and Three Tier Architecture
 
TypeScript With Node And Express
TypeScript With Node And ExpressTypeScript With Node And Express
TypeScript With Node And Express
 
10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration
 
Deep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormationDeep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormation
 
Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 

Viewers also liked

Middleware
MiddlewareMiddleware
Middleware
Prabhat gangwar
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
Anand kalla
 
Introduction to Email
Introduction to EmailIntroduction to Email
Introduction to Email
Made Aditya
 
Email - electronic mail
Email - electronic mailEmail - electronic mail
Email - electronic mail
kundana
 
Email - Electronic Mail
Email - Electronic MailEmail - Electronic Mail
Email - Electronic Mail
Peter R. Egli
 

Viewers also liked (8)

Middleware
MiddlewareMiddleware
Middleware
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Advance internet tools ppt
Advance internet tools pptAdvance internet tools ppt
Advance internet tools ppt
 
Another one on Email...
Another one on Email...Another one on Email...
Another one on Email...
 
Introduction to Email
Introduction to EmailIntroduction to Email
Introduction to Email
 
Email - electronic mail
Email - electronic mailEmail - electronic mail
Email - electronic mail
 
Email - Electronic Mail
Email - Electronic MailEmail - Electronic Mail
Email - Electronic Mail
 
Ppt on internet
Ppt on internetPpt on internet
Ppt on internet
 

Similar to Send email attachment using smtp in mule esb

Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
princeirfancivil
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
irfan1008
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
Praneethchampion
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
Phaniu
 
Email using mule
Email using muleEmail using mule
Email using mule
Manav Prasad
 
Email configuration in mule esb
Email configuration in mule esbEmail configuration in mule esb
Email configuration in mule esb
Vamsi Krishna
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
VirtusaPolaris
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
Vishnukanth Rachineni
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
Max Kleiner
 
Mule esb
Mule esbMule esb
Mule esb
sathyaraj Anand
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic file
Son Nguyen
 
Mule ESB
Mule ESBMule ESB
Mule ESB
Yura Nosenko
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
pat_91
 
File component in mule demo
File component in mule demoFile component in mule demo
File component in mule demo
Sudha Ch
 
mulesoft
mulesoftmulesoft
mulesoft
Thota Kumar
 
Web services
Web servicesWeb services
Web services
Thota Kumar
 
Dynamic file attribute
Dynamic file attributeDynamic file attribute
Dynamic file attribute
Anirban Sen Chowdhary
 
Mule basics
Mule basicsMule basics
Mule basics
VirtusaPolaris
 
File component
File component File component
File component
F K
 
File component in mule
File component in muleFile component in mule
File component in mule
Rajkattamuri
 

Similar to Send email attachment using smtp in mule esb (20)

Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Email using mule
Email using muleEmail using mule
Email using mule
 
Email configuration in mule esb
Email configuration in mule esbEmail configuration in mule esb
Email configuration in mule esb
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
 
Mule esb
Mule esbMule esb
Mule esb
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic file
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
File component in mule demo
File component in mule demoFile component in mule demo
File component in mule demo
 
mulesoft
mulesoftmulesoft
mulesoft
 
Web services
Web servicesWeb services
Web services
 
Dynamic file attribute
Dynamic file attributeDynamic file attribute
Dynamic file attribute
 
Mule basics
Mule basicsMule basics
Mule basics
 
File component
File component File component
File component
 
File component in mule
File component in muleFile component in mule
File component in mule
 

Recently uploaded

RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 

Recently uploaded (20)

RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 

Send email attachment using smtp in mule esb

  • 1. Send email attachment using SMTP in Mule ESB Presented by : Sreekanth Kondapalli
  • 2. What is Mule ESB ?  Mule ESB is a lightweight Java-based enterprise service bus (ESB) and integration platform that allows developers to connect applications together quickly and easily, enabling them to exchange data. Mule ESB enables easy integration of existing systems, regardless of the different technologies that the applications use, including JMS, Web Services, JDBC, HTTP, and more.
  • 3.  This example shows how we can send email attachment using SMTP connector to self or another email. We simply put a file in a source directory and Mule will read the file from the source directory.  Using Mule ESB it’s very easy to read the file from a location. If we had to read the file using manual coding then we had to write many lines of code. But using Mule ESB we just simply put a file in a directory and let the Mule know the file path and Mule does the rest of the thing. Y  You can put any kind of file to the source for reading. The file that we put into a source directory will be an attachment to the intended recipient’s mail address. So finally when we will see the file as an attachment in the mailbox. What is Mule ESB ?
  • 4. What is Attachment transformer ?  Attachment transformer lets us attach a file or document which will be sent to the email address.
  • 5. What is SMTP connector ?  The SMTP endpoint allows Mule messages to be sent as email or email attachments with the Simple Mail Transfer Protocol (SMTP) using Java mail API.
  • 6. Prerequisites  Mule Studio 3.5.1 JDK 1.6 Maven 3 Mule Runtime 3.5.0 CE Knowledge of XML
  • 7.  Open Mule Studio and create a mule project. Go to File->New->Mule Project. Now enter the Project Name, selectRuntime – Mule Server, check the check box for Use Maven. Now enter the following information  Group Id: your Mail(ex. gmail.com) Artifact Id: project name – file-attachment(automatically populated when project name is getting typed) V  Click Next and verify project Location and JRE/JDK are set correctly. Click Finishersion: Mule studio generates default
  • 8.  Now drag and drop the elements from right side of the Mule studio as shown below in the picture.
  • 9.
  • 10. Browse and select the path from where a file will be read for an attachment. Logger component properties
  • 11.  File to String transformer properties  File-to-Strong transformer just transforms the file object to human readable string format. We will not set any property for this element Attachment transformer properties
  • 12.  Using attachment transformer we can set payload from previous flow as an attachment. We have to select Content Type, operation as Set Attachment, Name, Value
  • 13.  SMTP connector properties For SMTP connector we have to input email host, user name, password, port under Basic Settings and To Address, From Address, Subject under Email Information.
  • 14.  The whole XML file of entire flow  <?xml version="1.0" encoding="UTF-8"?>   <mule xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp"  xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core"  xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"  xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd  http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd  http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd">  <flow name="file-attachmentFlow1" doc:name="file-attachmentFlow1">  <file:inbound-endpoint path="D:AnypointWorkspacesource"  responseTimeout="10000" doc:name="File" />  <logger message="#[payload]" level="INFO" doc:name="Logger" />  <file:file-to-string-transformer  doc:name="File to String" />  <logger message="#[payload]" level="INFO" doc:name="Logger" />  <set-attachment attachmentName="attachment" value="#[payload]"  contentType="text/plain" doc:name="Attachment" />  <logger message="#[payload]" level="INFO" doc:name="Logger" />  <smtp:outbound-endpoint host="mail.domain.com"  user="emailAddress@domain.com" password="password" to="emailAddress@domain.com"  from="emailAddress@domain.com" subject="Test Email" responseTimeout="10000"  doc:name="SMTP" />  <logger message="#[payload]" level="INFO" doc:name="Logger" />  </flow>  </mule>
  • 15.  Now create a text file called file-attachment.txt and put it under selected path, i.e., as per the above XML the file path is D:AnypointWorkspacesource.  Do right-click on file-attachment.xml and click on Run As -> Mule Application with Maven. Once the application up and running you will get the console output and email attachment in your mailbox where you have sent the email.
  • 16.  Output in console  INFO 2015-03-05 09:25:46,372 [[file-attachment].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: D:AnypointWorkspacesourcefile-attachment.txt  INFO 2015-03-05 09:25:46,404 [[file-attachment].file-attachmentFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: org.mule.transport.file.ReceiverFileInputStream@6a150e  INFO 2015-03-05 09:25:46,406 [[file-attachment].file-attachmentFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: This is a file content  INFO 2015-03-05 09:25:46,407 [[file-attachment].file-attachmentFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: This is a file content  INFO 2015-03-05 09:25:46,419 [[file-attachment].file-attachmentFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: This is a file content  INFO 2015-03-05 09:25:46,422 [[file-attachment].connector.smtp.mule.default.dispatcher.01] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.email.transformers.ObjectToMimeMessage  INFO 2015-03-05 09:25:46,428 [[file-attachment].connector.smtp.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.smtp.mule.default.dispatcher.1213248'. Object is: SmtpMessageDispatcher  INFO 2015-03-05 09:25:48,878 [[file-attachment].connector.smtp.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.smtp.mule.default.dispatcher.1213248'. Object is: SmtpMessageDispatcher
  • 17.  Click on the attachment. You will see the below output in the browser.