I want to send an email with a custom header that contains the following fields,
From:
To:
RT: (my custom field)
Below is my 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 "RT:"+rt
return m;
}