title: node-imap, mail event not working when multiple email comes
body: <p>I am using node-imap library to read mail, mail event is not getting triggered 2nd time after initialization.</p>
  
  <p>below is my code</p>
  
  <p>also, its giving Error: read ECONNRESET as error after 1st retrival of the email.</p>
  
  <p>Expecting imap.once('mail', function (x) { } should invoke whenever any new mail arises in the mailbox.</p>
  
  <p>imap.once('mail', function (x) { } is not getting triggered triggered.</p>
  
  <p>This event triggers only once when I run the node.js file, and later it is not getting triggered. Please sugggest.</p>
  
  <pre><code>imap.connect();
  
  imap.once('ready', function () {
      console.log("Imap ready");
      readMail();
  });
  
  function readMail() {
      openInbox(function (err, box) {
  
          imap.once('mail', function (x) {
              console.log("New Mail...", x);
              executeMail(err);
          });
      });
      }
  }
  </code></pre>
  
  <p>Tried below as per the comment but, still doses not worked.</p>
  
  <pre><code>function readMail() {
      openInbox(function (err, box) {
  
          imap.once('mail', function (x) {
              console.log("New Mail...", x);
              executeMail(err);
              imap.connect();
          });
      });
      }
  }
  </code></pre>