title: Using async in event emitter
body: <p>I am being challenged trying to make an async call inside an event.</p>
  
  <p>Here's the code from <a href="https://nodemailer.com/transports/ses/" rel="noreferrer">Nodemailer</a> - I've added the line where I need to make an async call:</p>
  
  <pre><code>let transporter = nodemailer.createTransport({
      SES: new aws.SES({
          apiVersion: '2010-12-01'
      }),
      sendingRate: 1 // max 1 messages/second
  });
  
  // Push next messages to Nodemailer
  transporter.on('idle', () =&gt; {
      while (transporter.isIdle()) {
  
          // I need to make an async db call to get the next email in queue
          const mail = await getNextFromQueue()
  
          transporter.sendMail(mail);
      }
  });
  </code></pre>
  
  <p>I found this <a href="https://stackoverflow.com/questions/45967019/nodejs-7-eventemitter-await-async">post</a> which suggest switching things around which makes sense however I have been unable to apply it correctly to this.</p>
  
  <p><em>Update</em> - The answer was to mock sendMail using Sinon.</p>