Upgrade to JavaMail 1.5.3. That official release has Bug 6496 -Message-Id leaks current user/hostname of the Java process marked as resolved.
Otherwise, the Message-ID computation uses the InternetAddress.getLocalAddress method which is including the username. You can set the mail.from session property to override including the O/S user name.
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put("mail.from", "------@bar.baz");
Session s = Session.getInstance(props);
MimeMessage m = new MimeMessage(s);
m.addFrom(InternetAddress.parse("foo@bar.baz"));
m.setText("");
m.saveChanges();
m.writeTo(System.out);
}
Which will output something like:
From: foo@bar.baz
Message-ID: <1688376486.0.1429814480627.JavaMail.------@bar.baz>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
If you are using the default session you can just add 'mail.from' to the system properties.