code: function checkEmail(msg, node) {
                  if (node.protocol === 'POP3') {
                      checkPOP3(msg);
                  } else if (node.protocol === 'IMAP') {
                      console.log('Inside checkEmail');
                      imap = new Imap({
                          user: node.userid,
                          password: node.password,
                          host: node.server,
                          port: node.port,
                          tls: node.useSSL,
                          tlsOptions: {rejectUnauthorized: false},
                          connTimeout: (node.repeat - 10),
                          authTimeout: (node.repeat - 10),
                      });
  
                      imap.on('error', function(err) {
                          if (err.errno !== 'ECONNRESET') {
                              node.log(err);
                              node.status({fill: 'red', shape: 'ring', text: 'email.status.connecterror'});
                          }
                      });
  
                      checkIMAP(msg, node.attachment);
                  }
              }
docs: End of checkIMAP 
  // Perform a check of the email inboxes using either POP3 or IMAP
  
  @param {any} msg
  @param {any} node