Details
-
Improvement
-
Resolution: Invalid
-
Major
-
None
-
7.1-milestone-2
-
None
-
Unknown
-
Description
Currently, a factory creates a MimeMessage and this message is added to the prepare queue, as it is. It is saved in the MailContentStore and and added to the send queue. This means that a factory (or it's user) is free to specify a custom Message-ID and it is saved correctly.
However, in the send queue peocessing, it is read as a generic MimeMessage (new MimeMessage (session, is)) and this has the effect that the standard JavaMail behavior kicks in when the mail is sent and a random Message-ID is generated instead of whatever was set in the original message's headers.
The recommended way of handling custom Message-IDs is to extend MimeMessage and override the updateMessageID method, but even if you do that, XWiki's mail API will override you in the send mail step, as described above.
The solution would be to add to ExtendedMimeMessage the overriden updateMessageID method and only generate a Message-ID if none was previously set. Also, the send mail step would instantiate a ExtendedMimeMessage instead of a generic MimeMessage when loading the message from the MailContentStore.
Attachments
Issue Links
- links to