Why don't you set sender as part of MailMessage when you are sending the mail?
The reason why I'm trying to set it in the server's configuration file is the same that made me set the rest of the parameters there too: I want to move the configuration to the container level so that my application can be deployed elsewhere without the need of altering its content by hand.
Some people may consider the sender address dynamic data that should be set in the application. But, in my opinion, in most cases it's static data. So it can be considered part of the configuration too. In fact, Wildfly lets you configure the sender address at the container level. So, Why not to allow to configure the sender name or alias too?
With regard to the use of MimeMessage to set the sender name, I've tried to use the method setSender (). However, it makes you specify an address. Which I don't want, because it overrides the address set in the configuration. Or am I wrong?