Email send operation via Gmail
- April 13, 2020
This tech article explains how to send an email using Mule 4 via Gmail integration.
- Start by adding a Listener in Mule flow and configuring the Listener configuration
- Provide a suitable method for a resource.
- Add an email connector in your working space and drag/send email activity to Mule Canvas.
- Configure the email connector
Username: This is the Gmail ID for which you want to configure SMTP details.
Password: For this, you need to generate a Google token. Follow the steps below steps to generate a token:
- Enable Gmail 2-step verification: https://www.google.com/landing/2step/
- Go to https://security.google.com/settings/security/apppasswords and try to generate an app password.
- Select Mail in the app list, then select your preferred device and generate a token.
- Paste the token generated in password.
- Enable Gmail 2-step verification: https://www.google.com/landing/2step/
- On your Mule application, define an SMTP configuration.
- Go to the Advanced tab in configuration.
- In Properties, select edit inline and set value as follows:
Key: “mail.smtp.starttls.enable”
Value: “True”
- In mail activity, provide the following info:
- To address
- From address
- Subject
- Body
- Build and deploy the application.
- Test the application — hit Listener with URL.
- Check mail.
— By Ritendra Dhakciya