When I send email from my application using the default WildFly mail session, the auto-generated message ID gives away that my server is WildFly:
Message-ID: <524672585.11.1429091886393.JavaMail.wildfly@myserver.example.com>
For security reasons, I'd like to suppress or override the wildfly
substring in the message ID.
Is there a configuration element or a system property to do that?
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.
Which will output something like:
If you are using the default session you can just add 'mail.from' to the system properties.
Answering my own question: The
wildfly
part of the message ID corresponds to the value of theuser.name
system property. My server happens to be running under a Linux user account namedwildfly
.So one option would be to use a different user account. Alternatively, simply passing
-Duser.name=foo
to the WildFly start script is enough to change the message ID.