Skip to content

feat: customizable message-id prefix - #13694

Open
luca9913 wants to merge 3 commits into
nextcloud:mainfrom
luca9913:feat/settings/customizable-message-id
Open

luca9913 wants to merge 3 commits into
nextcloud:mainfrom
luca9913:feat/settings/customizable-message-id

Conversation

@luca9913

@luca9913 luca9913 commented Sep 16, 2026

Copy link
Copy Markdown

Closes #624.

Summary

In order to allow users to set their own Message-ID prefix, we introduce an admin setting with a default value 'nextcloud-mail' and use that prefix from the settings to create a RFC 5322 compliant Message-ID header for outgoing mail and drafts.

The wish to "remove the server name" from the Message-ID in the original issue description is not met. The server name is inserted in the Horde library and the function Horde_Mime_Headers_MessageId::create does not accept any argument to "hide" that name.

Changes

Settings

  • add an entry MESSAGE_ID_PREFIX to OCA\Mail\ConfigLexicon with default value 'nextcloud-mail'
  • add a field to settings form in getForm() @OCA\Mail\Settings\AdminSettings using the initialStateService
  • register POST route /api/settings/messageidprefix in routes.php
  • add an handler for that new route (setMessageIdPrefix) to OCA\Mail\Controller
  • include a new form #mail-message-id-prefix in the NcSettingsSection @ src/components/settings/AdminSettings.vue
  • add a submit handler for that new form to src/service/SettingsService.js

Mail transmission

  • inject the IAppConfig into OCA\Mail\Service\MailTransmission to fetch the current value configured in the settings
  • use the ConfigLexicon::MESSAGE_ID_PREFIX value to build a header in sendMessage()
  • use the value in buildMimeHeaders() that is used by saveLocalDraft() and saveDraft() in OCA\Mail\Service\MailTransmission

How to test

  1. Open the Groupware section in the admin settings
  2. Check that the input 'Message-ID prefix' at the bottom of the page is initialized with the default value 'nextcloud-mail'
  3. Change the default value to a value of your choice
  4. Send an email and inspect its headers
  5. Check that the configured prefix was inserted into the Message-ID header
  6. Optional: Create a draft message, download it and check for the header using a program that can display EML files

TODO / Open questions

Please add your questions and TODOs

Checklist

  • Unit tests added/updated
  • Manual testing done
  • Documentation updated (if needed)
  • Changelog entry added (if required by project convention, please let me know what convention exists)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

@welcome

welcome Bot commented Sep 16, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in this repository! ✌️

@luca9913
luca9913 force-pushed the feat/settings/customizable-message-id branch from f3e23a3 to dd0a356 Compare September 16, 2026 14:40
…used in the message ID header of outgoing mail

Signed-off-by: luca9913 <luca_trumpf@protonmail.com>
…ConfigLexicon to inject the custom prefix into the message ID header for outgoing mail and drafts

Signed-off-by: luca9913 <luca_trumpf@protonmail.com>
…ffected by the newly introduced setting "message_id_prefix"

Signed-off-by: luca9913 <luca_trumpf@protonmail.com>
@luca9913
luca9913 force-pushed the feat/settings/customizable-message-id branch from dd0a356 to d1136f2 Compare September 16, 2026 14:45
@luca9913

Copy link
Copy Markdown
Author

I used the wrong name in the sign-off message. I corrected the commit messages to match the expected username by rebasing the commits with the --signoff parameter.

@luca9913
luca9913 marked this pull request as ready for review September 16, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change Message-ID format

1 participant