Skip to content

Only able to connect two listeners? #59

@MuckT

Description

@MuckT

I've been using mail-notifier for testing email delivery in some e2e tests using protractor. In general the library is working as expected; however, I am noticing when I try to run three listeners at once I am running into issues in that all the listeners throw, 'Error: LOGIN failed.'; however, two listeners appear to be working fine. Below is my sanitized code for my email util. I am starting the mail listeners before the execution of my test cases and simply checking the arrays in my test cases. Any help is appreciated!

const temp00Notifier = require('mail-notifier');
const temp01Notifier = require('mail-notifier');
const temp02Notifier = require('mail-notifier');

const temp00RecievedEmails: Array<object> = [];
const temp01RecievedEmails: Array<object> = [];
const temp02RecievedEmails: Array<object> = [];

export async function startTemp00MailListener() {
  const imap = {
    user: 'email_00@fakemail.com',
    password: 'Password',
    host: 'sampleHost.com',
    port: 993,
    tls: true,
    tlsOptions: { rejectUnauthorized: false },
  };
  await temp00Notifier(imap).on('mail', (mail: any) => temp00RecievedEmails.push(mail)).start();
}

export async function startTemp01MailListener() {
  const imap = {
    user: 'email_01@fakemail.com',
    password: 'Password',
    host: 'sampleHost.com',
    port: 993,
    tls: true,
    tlsOptions: { rejectUnauthorized: false },
  };
  await temp01Notifier(imap).on('mail', (mail: any) => temp01RecievedEmails.push(mail)).start();
}

export async function startTemp02MailListener() {
  const imap = {
    user: 'email_02@fakemail.com',
    password: 'Password',
    host: 'sampleHost.com',
    port: 993,
    tls: true,
    tlsOptions: { rejectUnauthorized: false },
  };
  await temp02Notifier(imap).on('mail', (mail: any) => temp02RecievedEmails.push(mail)).start();
}

export async function getTemp00RecievedEmails() {
  return temp00RecievedEmails;
}

export async function getTemp01RecievedEmails() {
  return temp01RecievedEmails;
}

export async function getTemp02RecievedEmails() {
  return temp02RecievedEmails;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions