Set Up Google Mail (OAuth) for Email Import

You can configure the import processor to use Google mail OAuth to import files attached to incoming email messages along with email message elements such as subject and body text, into Content Capture. Each imported email message becomes a batch, with email elements such as attachments, message body, or entire email message created as separate documents within the batch.

Obtain the Redirect URL for Creating a Google Mail App

To be able to configure a Google Mail app, you need the content capture host name and authorization URL details of the Oracle Content Management instance you want to connect to.

To obtain the redirect URL:

  1. Sign in to Oracle Content Management as an administrator and click Capture in the left navigation menu.
  2. On the Capture Procedures page, select your procedure, and then go to the Capture tab.
  3. In the Import Processor Jobs table, click Add import processor job to create a new job.

  4. On the General Settings page:
    1. Enter a name in the Import Job Name field and a prefix in the Batch Prefix field. Imported batches are named using this prefix, followed by a number that increments with each new batch.
    2. In the Import Source field, make sure that you select Email Source.
  5. On the Import Source Settings page, in the Connection Protocol section, select Google Mail (OAuth).

    A Redirect URL is displayed. Copy this URL whose format is https://<hostname>.<domainname>:<port>/capture/admin/faces/completeAuthorization. Your URL may or may not have a port. Without a port, the URL would be in this format: https://<hostname>.<domainname>/capture/admin/faces/completeAuthorization

    Note:

    Don’t yet submit your inputs or navigate away from this page. You need to return to this page to configure Google mail OAuth, after you’ve created a Google Mail app and obtained the Client ID and Client Secret. You’ll enter them in the Client ID and Client Secret fields.

Configure a Google Mail App for Email Import

To configure a Google Mail app:

  1. Go to the Google APIs console in another browser window.
  2. On the Manage resources page, you will see a list of your projects if you've already created them in the Google Developers Console. If you haven’t done so already, do the following:
    1. Click CREATE PROJECT.
    2. Enter a Project name.
    3. To help you easily identify your project in the console, edit the Project ID by clicking EDIT and entering a meaningful ID.
    4. You need to select a location if you've defined any organizational resources or folders. If not, accept the default and click CREATE.

      Your project will be created, and you'll be redirected to your project list in the console.

  3. On the upper left corner, click Google developer navigation icon, select APIs & Services and then select Dashboard.

    Note:

    If you are not viewing the recently created project's dashboard, select your project from the drop-down list in the upper left corner.
  4. In the left sidebar, click Library to go to the API Library page. Then search for the Gmail API library and enable it.
  5. On the upper left corner, click Google developer navigation icon, select APIs & Services and then OAuth consent screen. Choose your target users on the OAuth consent screen, and then click CREATE.
  6. On the Edit app registration page, on the OAuth consent screen tab:
    • In the App name field, enter your product name, for example, Gmail App.
    • In the User support email drop-down list, select your email address for user support.
    • Scroll down to the Developer contact information section and in the Email addresses field, enter your email address.
    • Click SAVE AND CONTINUE.
  7. On the Scopes tab:
    1. Click ADD OR REMOVE SCOPES.
    2. In the Update selected scopes section, either select check boxes for the following GMail API scopes, or manually enter these scopes in the Manually add scopes box and click ADD TO TABLE. Then click UPDATE.
      • https://www.googleapis.com/auth/userinfo.email
      • https://www.googleapis.com/auth/gmail.modify
      • https://www.googleapis.com/auth/userinfo.profile
    3. Click SAVE AND CONTINUE.

      The userinfo.email and userinfo.profile scopes are displayed in the Your non-sensitive scopes section and the gmail.modify scope is displayed in the Your restricted scopes section on the Scopes tab.

  8. On the Test users tab, click SAVE AND CONTINUE.
  9. On the Summary tab, you can review your settings and then click BACK TO DASHBOARD.
  10. Under Publishing Status, in the Testing section, click PUBLISH APP and then in the Push to production? dialog, click CONFIRM to publish the app.
  11. On the left side bar, click Credentials and then do the following:
    1. On the Credentials page, click CREATE CREDENTIALS, and then select OAuth client ID.
    2. In the Application type drop-down list, select Web application.
    3. Name the client, for example, Gmail OAuth App Client.
    4. In Authorized redirect URIs, click ADD URI and paste the redirect URL you copied from your capture procedure.
    5. In Authorized JavaScript origins, click ADD URI and paste the redirect URL, but remove everything after the domain or after the port if your URI includes a port.
    6. Click CREATE.

      Your Client ID and Client Secret values are displayed in the OAuth client created dialog. Make a note of these values and then click OK.

      Now go back to Content Capture in Oracle Content Management and begin where you left. That is, begin with entering the client ID and secret to configure Google mail OAuth.

Configure Google Mail OAuth for Capture Email Import

To configure Google Mail OAuth email import processor job settings:

  1. Go back to your procedure and begin where you left.
  2. On the Email Accounts tab, you selected Google Mail (OAuth) connection protocol. Now, enter the client ID and secret you copied at the time of configuring your Google mail app in the Client ID and Client Secret fields.
  3. In the Email Accounts to Process table, click Add email account.

  4. To provide the email processor job an access to the email account, on the Google Mail sign-in page, enter the email address and password of the email ID you are going to use.

  5. Confirm your choices by clicking Allow.

    The email ID is displayed in the Email Accounts to Process table under the Email Addresses column. Its status should be Verified.

    You can add more Google Mail IDs in this table using the steps you followed so far. To delete an email ID, select its row in the table and then click Delete email ID.

  6. On the Message Filters tab, specify where and how to search for email messages and/or attachments.

    1. In the Folders to Process field, enter one or more folders to search in the specified email accounts. The default value is the server inbox. To specify multiple folders, separate them with a ; (semi-colon). To specify subfolders, include a path delimiter applicable for the mail server, such as a / (forward slash), as in folder/subfolder.

    2. By default, Content Capture processes all emails in the specified folder unless a message filter is applied to the job. Optionally, in the Message Filters table, select the Enabled field for each email element to search, then enter characters to find in the Field Contains field.

      For example, to search for emails whose subject or message body contains the word payment, you would select Enabled for both search fields, include payment in each Field Contains entry, and select the Or search operator.

    3. In the Search Operator field, select the search operator to use for the specified message filters: And (default) imports only if all search criteria match, while Or imports if any search criteria matches.

  7. On the Processing tab, specify how to process the email messages and their attachments. You can specify which information to include and the priority to assign to batches, based on the email priority.

    1. Under Email Message Options, specify if the message body file should be imported. Specify its import format (text or EML) and whether it should be included when no attachments are present, and if the entire email message (including attachments) should be imported as an EML file.

    2. In the Include attachments matching these masks(s) field, specify attachment files based on their file masks. You can enter multiple file masks separated by a comma or semi-colon. For example, you might include all PDF files (*.pdf).

    3. In the Exclude attachments matching these mask(s) field, specify attachment files to exclude based on their file masks. You can enter multiple file masks separated by a comma or semi-colon.

    4. Optionally, select Always post-process when attachments do not match mask(s), Include attachments matching these mask(s) and Exclude attachments matching these mask(s). If this field is enabled and the attachments do not match the mask(s) specified, then the email import is considered unsuccessful and post-processed according to the settings you specify under the Upon Failed Import field in the Post-Processing tab.

      Note:

      The Always post-process when attachments do not match mask(s) field is disabled when both Import message body file and Include when no attachments exist fields are enabled together.
    5. Under Document Ordering, specify the order in which the elements (for example, message body and attachments) from an email message are to be ordered as documents in imported batches.

    6. Under Include in Batch Note, select message elements (such as Received Date/Time, From Address, To Address, Subject, and Message Body).

    7. Under Batch Priority, optionally assign a priority to each new batch based on its email priority (low, normal, or high). For example, enter 8 in the High field to assign high priority emails a batch priority of 8 in Content Capture. Emails not assigned a priority are considered normal priority.

  8. On the Post-Processing tab, specify what happens to email messages after successful or failed import. You can delete messages, move them to a specified folder within the email account, or in the case of failed import, prevent messages from being deleted. For example, if the job is run regularly, you might prevent successfully imported emails from being imported again by moving them to a specified folder.

  9. Complete other import processor job pages as described in Add or Edit an Import Processor Job.

You can now test the email import job. The import processor checks the configured email accounts for messages and searches folders for matching emails. If matching emails are found, the import processor creates a batch and a document for each document being imported from the email message. Optionally, the import processor populates metadata fields with email metadata and deletes successfully imported messages, or it moves them to a folder.

Periodically, Content Capture fetches emails from the email account you configure on the Email Accounts tab. However, if you want to trigger an email import at a certain time, select an email import job in the Import Processor Jobs table and click the Check email icon. This icon is disabled if your email import job is offline.