title: Set MessageId in header before sending mail
body: <p>I am sending mails from my application using JAVA mail on smtp server, port 465. My need is that, I have to set Message-ID before sending mail. I did some R&amp;D and found the code below. I had override the method <code>updateMessageID()</code> of <code>MimeMessage</code></p>
  
  <pre><code>import javax.mail.MessagingException;
  import javax.mail.Session;
  import javax.mail.internet.MimeMessage;
  
  public class CustomMimeMessage extends MimeMessage {
  
  public CustomMimeMessage(Session session) {
      super(session);
  }
  
  @Override
  protected void updateMessageID() throws MessagingException {
  
      setHeader("Message-ID", "message id");
  
     }
  }
  </code></pre>
  
  <p>And then I had made an instance of <code>CustomMimeMessage</code> in my service and then invoke <code>updateMessageID()</code> method using that instance, but I still get the Message-ID generated by gmail.</p>