Using Anypoint Studio to Configure Email Connector 1.4 - Mule 4
Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files.
To add and configure a connector in Studio:
When you run the connector, you can view the app log to check for problems, as described in View the App Log.
If you are new to configuring connectors in Studio, see Using Anypoint Studio to Configure a Connector. If, after reading this topic, you need additional information about the connector fields, see the Email Connector Reference.
Create a Mule Project
In Studio, create a new Mule project in which to add and configure the connector:
-
In Studio, select File > New > Mule Project.
-
Enter a name for your Mule project and click Finish.
Add the Connector to Your Mule Project
Add Email Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and to add the required dependencies to the project’s pom.xml
file:
-
In the Mule Palette view, click (X) Search in Exchange.
-
In the Add Dependencies to Project window, type
email
in the search field. -
Click Email Connector in Available modules.
-
Click Add.
-
Click Finish.
Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace.
Configure a Source
A source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Email Connector:
-
On New Email - IMAP
Initiates a flow by retrieving all the emails from an IMAP mailbox folder, watermark can be enabled for polled items -
On New Email - POP3
Initiates a flow by retrieving all the emails from an POP3 mailbox folder -
HTTP > Listener
Initiates a flow each time it receives a request on the configured host and port -
Scheduler
Initiates a flow when a time-based condition is met
For example, to configure the On New Email - IMAP source , follow these steps:
-
In the Mule Palette view, select Email > On New Email - IMAP.
-
Drag On New Email - IMAP to the Studio canvas.
-
On the On New Email - IMAP configuration screen, optionally change the value of the Display Name field.
-
Click the plus sign (+) next to the Connector configuration field to configure a global element that can be used by all instances of the source in the app.
-
On the Email IMAP window, for Connection select any of the connection types to provide to this configuration:
-
IMAP Connection
-
IMAPS Connection
-
-
On the General tab, specify the connection information for the connector, such as Host, Port and TLS configuration.
-
On the Advanced tab, optionally specify timeout configuration and reconnection information, including a reconnection strategy.
-
Click OK.
-
On the On New Email - IMAP configuration screen, in the General section, select a Scheduling Strategy to configure the scheduler that triggers the polling.
Add a Connector Operation to the Flow
When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform.
To add an operation for Email Connector, follow these steps:
-
In the Mule Palette view, select Email and then select the desired operation.
-
Drag the operation onto the Studio canvas and to the right of the input source.
The following screenshot shows the Email Connector operations in the Mule Palette of Anypoint Studio:
Configure a Global Element for the Connector
When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element for Email Connector requires you to set a configuration based on the supported protocols for the connector operations:
Global Element Configuration | Connector Operation/Sources |
---|---|
IMAP (Internet Message Access Protocol) |
|
POP3 (Post Office Protocol 3) |
|
SMTP (Simple Mail Transfer Protocol) |
|
For example, to configure a POP3 global element for the List POP3 operation, follow these steps:
-
Select the name of the connector in the Studio canvas.
-
Select the List POP3 operation in the Studio canvas.
-
In the List POP3 configuration screen for the operation, click the plus sign (+) next to the Connector configuration field to access the global element configuration fields. On the Email POP3 window, for Connection select any of the connection types to provide to this configuration:
-
POP3 Connection
-
POP3S Connection
-
-
On the General tab, specify the connection information for the connector, such as Host, Port and TLS configuration.
-
On the Advanced tab, optionally specify timeout configuration and reconnection information, including a reconnection strategy.
-
Click OK.
The following screenshot shows the Email Connector Global Element Configuration window in Anypoint Studio:
Configure Additional Connector Fields
For IMAPS, POP3S, and SMTPS protocol connections, you can use Transport Layer Security (TLS) and configure email by providing a key store with your certificate. Additionally, you can also enable two-way authentication by providing a trust store. For details, see Email Connector Reference and Configure TLS with Keystores and Truststores.
View the App Log
To check for problems, you can view the app log as follows:
-
If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window.
-
If you’re running the app using Mule from the command line, the app log is visible in your OS console.
Unless the log file path is customized in the app’s log file (log4j2.xml
), you can also view the app log in the default location MULE_HOME/logs/<app-name>.log
.