- Gmail has special setup requirements
- Must set email for less secure app access
- Cannot account is two-factor authentication set up
Mule email connector configuration
The email connector is available from Anypoint Exchange and can be download directly in to anypoint Studio or added with the Maven coordinates, see figure 1.
<dependency> <groupId>org.mule.connectors</groupId> <artifactId>mule-email-connector</artifactId> <version>1.3.0</version> <classifier>mule-plugin</classifier> </dependency>
Figure 1: The Maven coordinates for the Mule email connector
The SMTP setting for Gmail are set in the email connector’s global configuration element.
Your Gmail address
Your Gmail password
- Ensure that the TLS Configuration is check:
Full configuration shown in figure 2.
Gmail setup requirements
The Gmail account must be setup to be used with the email connector. The simplest configuration is to enable access to your Google account via less secure methods. This approach comes with a warning that you increase the vulnerability of your application.
Enable less secure access
Log into your email account and visit the link to security. Scroll to the section entitled Less secure app access and switch it on. See figures 3.
Now that the Gmail account is enabled to allow the Mule email connector to access and use the email features you can continue to build your application. You can send HTML formatted emails and embed images into the body of the email.
This approach to setting up the email connector is quick and easy and allows you to provide a quite solution, which results in your email account becoming vulnerable. It would be recommended to set up a new email account for use with the email connector. Although it is recommended that you set up an email server that is under that control of your organization therefore allowing security to be ensured.