Author: Ritendra Dhakciya
This blog provides information about how we can send an email using Mule 4 via Gmail integration.
Let’s start!
First we need to add a listener in mule flow
Step 1: Configure Listener Configuration

Then give a suitable method for a resource.
Step 2: Add email connector in working space and drag send email activity in mule canvas

Step 3: Configure email connector

Username: This is the Gmail id that you want to configure SMTP details for
Password: For this, we need to generate a google token. Follow the below steps to help you generate a token:
- Enable Gmail 2-step verification:
https://www.google.com/landing/2step/

- Access https://security.google.com/settings/security/apppasswords, try to generate an App password.

3. Select ‘Mail’ in app list, then select preferred device in list and generate token.

Paste token generated in password.

4. On your Mule Application, define a SMTP config. Go to ‘Advanced’ tab in configuration.
In properties select edit inline and set value as below:
Key: “mail.smtp.starttls.enable”
Value: “True”

Step 4: In mail activity give the below
- To address
- From address
- Subject
- Body

Step 5: Build and deploy application
Step 6: Test the application.
Hit listener with url.

Check Mail Box:
