Skip to content

[minor/PH-129028] Switch mail listener dependencies

Daniel Chicchon requested to merge minor/PH-127692 into master

Summary

In this MR we are switching to a new dependency, ImapFlow which will allow for more control over how we handle receiving emails. This listener takes in similar properties to the previous adapter. There were some properties that were no longer being used so I went ahead and removed those.

The main addition to the email adapter is the method parseUnread. Specifically, this method makes use of the new mailset property which will hold values for unique mail ids in the inbox. We use this property to ensure that no duplicate emails are being published to our eventSystem.

To confirm, there are no changes to the SMTP functionality of the adapter, only the IMAP functionality.

How to Test

  1. Import this adapter to the @itentialopensource directory. Create the adapter in admin essentials.
  2. You can utilize the below properties for your outlook email. Confirm the adapter is running on the profiles/adapters page.
{
  "name": "email",
  "model": "@itentialopensource/adapter-email",
  "type": "Adapter",
  "properties": {
    "id": "email",
    "type": "Email",
    "brokers": [
      "notification"
    ],
    "groups": [],
    "properties": {
      "auth": {
        "user": "<your email>",
        "pass": "<your password>"
      },
      "service": "Outlook365",
      "host": "outlook.office365.com",
      "port": 993,
      "secure": true,
      "tls": {
        "rejectUnauthorized": false
      },
      "subscriptions": [
        "email-event-unseen"
      ],
      "incomingEmailSizeLimit": 10000
    }
  },
  "isEncrypted": false,
  "loggerProps": {
    "description": "Logging",
    "log_max_files": 100,
    "log_max_file_size": 1048576,
    "log_level": "info",
    "log_directory": "./logs",
    "log_filename": "email.log",
    "console_level": "warn"
  },
  "virtual": false
}
  1. Import this workflow: test-wf.json
  2. Import this automation to ops manager: email-job.json
  3. Send yourself an email with the subject test. You should see 1 job has started

The purpose of this MR is to ensure no duplicate jobs are being created here. We should ensure that the testing of this adapter is capable of handling 10s to 1000s of emails without duplicating or missing a job.

Tickets

Solves PH-129028

Edited by Daniel Chicchon

Merge request reports