title: When does the TransportEvent get fired in Java mail?
body: <p>I am trying to get the Message-Id of the sent message by using listeners.
  I am implementing<br>
  javax.mail.event.TransportListener with concrete methods given in code sample.</p>
  
  <p>It listens to  javax.mail.event.TransportEvent which gets generated when void javax.mail.Transport.sendMessage(.....) is called.</p>
  
  <p>To my surprise I get none of the method gets called when I actually send the mail..??? When does it actually get called ? Do I need to add any wait time after calling sendMessage(..)??</p>
  
  <p>Doesn't it happen in real time ? </p>
  
  <pre><code>@Override
  public void messageDelivered(TransportEvent e)
  {
      try {
          System.out.println(e.getMessage().getHeader("Message-Id")[0]);
      } catch (MessagingException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
  }
  
  @Override
  public void messageNotDelivered(TransportEvent e) 
  {
      try {
          System.out.println(e.getMessage().getHeader("Message-Id")[0]);
      } catch (MessagingException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }       
  }
  
  @Override
  public void messagePartiallyDelivered(TransportEvent e) 
  {
      try {
          System.out.println(e.getMessage().getHeader("Message-Id")[0]);
      } catch (MessagingException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }       
  }
  </code></pre>