title: How to add custom field in email header using Message class in Java
body: <p>I want to send an email with a custom header that contains the following fields,</p>
  <p>From:</p>
  <p>To:</p>
  <p>RT: (my custom field)</p>
  <p>Below is my code</p>
  <pre><code>public Message createHeader(InternetAddress from, Address to, Address rt) throws MessagingException {
      Message m = new MimeMessage(emailSession);
      m.setFrom(from);
      m.setRecipient(Message.RecipientType.TO, to);
      // add my custom filed &quot;RT:&quot;+rt
      return m;
  }
  </code></pre>