Getting Started with Sending and Receiving Email in FME Form and FME Flow

Tandra Geraedts
Tandra Geraedts
  • Updated

Introduction

This article will go over the various steps required to send an email from a Google account within FME Form and FME Flow. There are a few items to configure on FME Form and Flow, as well as a few steps that need to be done within the Google API Console. These steps are the general steps for how to set this up, your organization's security and IT policies may not allow for some of this configuration to be done. If this is the case, you’ll need to reach out to the appropriate people within your organization. 

 

Configure FME Form to Use Gmail

To send an email from FME Form, you’ll need to install the Emailer transformer. The Emailer is a package-based transformer within FME Workbench. 

 

Emailer Transformer

From the workbench toolbar, select Transformers and start typing “emailer”. Select the Emailer transformer and install it. The Emailer transformer allows you to send emails from Workbench from Gmail, Outlook, and Yahoo but this tutorial will focus on the details for Google Gmail.

If you are updating an FME Workspace, the Emailer package may be out of date. Emailer versions prior to V 2.0.0 will not work with Google’s verified apps. Please see the steps below:

 

The Emailer Package web service definition has been updated to use a new Google-verified app. The current package update process won’t overwrite the package previously-installed web service, therefore to obtain this new FME provided web service definition, you’ll need to do the following:

  1. Uninstall the Emailer package
    • Go to Tools > FME Options > FME Packages
    • Find the Emailer and select ‘Remove’. When prompted by a warning, select Yes
  2. Remove the safe.emailer.Google Gmail Web Service
    • In FME Options, go to Web Connections > Manage Web Services
    • Find safe.emailer.Google Gmail and select the minus button. When prompted, select OK. Note that this will remove all associated Gmail Web Connections.  
  3. Return to the FME Workbench canvas and add the Emailer transformer. This will install the latest version of the package - containing the verified web service. 
  4. Recreate your email web connection(s) under the same name. This will mean you do not need to update all of the workspaces that use this connection. 

 

Creating a Web Connection

After the Emailer transformer is installed, a new web service and web connection will need to be created. The default web service is set to read-only, and you will not be able to use it on FME Flow. To create a new web service, go to Tools > FME Options, select Web Connections, and Manage Services. Click the plus sign drop-down menu at the bottom left and select “Create from” and Google Gmail. Give the new web service an appropriate name and click Apply, then Close.

Next, we need to create a Google App that provides the Client ID and Client Secret that the web services require to run.

 

Generate an App Password

The Gmail Web Service definition that is provided by Safe Software is recommended for demo purposes only. Therefore the preferred option may be to create your own Google App (client ID/secret) for use within FME. Since this is an app created by your account within Google, there is no risk of access being denied in the future. To do this, you will need to:

1. Visit Google API Console

2. Create a new project

3. Once in your project, configure the OAuth consent screen. You'll first need to choose if your app is for internal purposes only.

Then fill in some additional information about the application. There is no need to add an application logo. This information will not be publicly available either. 

4. If you’ve created an External App, return to the OAuth consent screen and click Publish App.

image.png

5. Under the Enabled APIs & Services tab, click the Enable APIs and Services option. 

image.png

Search for the Gmail API in the API Library. Choose to Enable the Gmail API. 

image.png

Use the back arrow to return to the APIs & Services page.

 

6. Create your Client ID and Secret

 

For the application type select ‘Desktop App'. 

For FME Flow, another Client ID will need to be created with the type ‘Web Application’

For FME Flow connections, additional redirect URIs are required. For URIs 1* you’ll need to use your own FME Flow host, <yourFMEFlowInstance>/fmeoauth

You'll now have a new Client ID and Secret that you can set your Gmail Web Service to use in FME. 

 

7. Return to FME Workbench > FME Options, and under Web Connections, select 'Manage Services...'

 

8. Find your Google Gmail Web Service and update the Client ID/Secret under the Client Information Header with the ones you just created.

 

Configure FME Flow to Use Gmail

In order to send or receive emails in FME Flow, the Gmail account needs to have 2-factor authentication set up and you will need to generate an app password. This app password replaces the SMTP password in the configuration. In order to receive emails, you will need to enable IMAP for your Google Account. 

 

Sending Emails

Here are the settings for configuring an FME Flow Automation to send emails using the Gmail SMTP Server:

  • SMTP Server: smtp.gmail.com
  • SMTP Server Port: 465
  • SMTP Account: <your Gmail email address>
  • SMTP Password: <your app password>
  • Connection Security: SSL/TLS

These settings, excluding your Gmail address and password, are preconfigured from Load Template > Gmail in the Email (send) external action details. 

 

Receiving Emails

Here are the settings for configuring an FME Flow Automation to receive emails through an Email - IMAP trigger using the Gmail IMAP Server: 

  • IMAP Server Host: imap.gmail.com
  • IMAP Server Port: 993
  • IMAP Email Account: <your Gmail email address>
  • IMAP Email Password: <your app password>
  • Connection Security: SSL/TLS
  • Verify SSL Certificate: Yes

Again, these settings are preconfigured from Load Template > Gmail in the Email - IMAP trigger. 

 

Troubleshooting

 

Additional Resources

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.