nodejs-mail-notifier icon indicating copy to clipboard operation
nodejs-mail-notifier copied to clipboard

Only able to connect two listeners?

Open MuckT opened this issue 6 years ago • 1 comments

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 protected]',
    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 protected]',
    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 protected]',
    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;
}

MuckT avatar Jun 06 '19 23:06 MuckT

Hi,

Are you sure you are allowed to have more than 2 simultaneous connections to your smtp server ?

jcreigno avatar Jul 15 '19 09:07 jcreigno