Skip to content

Bug 1837680: Add Message-ID header when missing at send#146

Open
mrenvoize wants to merge 5 commits into
bugzilla:mainfrom
mrenvoize:bug_1837680
Open

Bug 1837680: Add Message-ID header when missing at send#146
mrenvoize wants to merge 5 commits into
bugzilla:mainfrom
mrenvoize:bug_1837680

Conversation

@mrenvoize

Copy link
Copy Markdown
Contributor

Detect whether a Message-ID header has been included in the message passed to MessageToMTA and generate one if it's missing.

GMail and other modern mail services now expect a Message-ID as part of the message else they mark them as spam or drop them entirely.

** This is a port of the same bug fix submitted for Bugzilla 5.2 **

@justdave

justdave commented Jun 6, 2026

Copy link
Copy Markdown
Member

GitHub isn't very good with messaging... the force-push was rebasing this PR on top of the target branch since there's been a bunch of upstream changes since it was filed.

@justdave justdave left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review comments from bugzilla/bugzilla#205 also apply here.

mrenvoize and others added 4 commits June 22, 2026 19:31
Detect whether a Message-ID header has been included in the message
passed to MessageToMTA and generate one if it's missing.

GMail and other modern mail services now expect a Message-ID as part of
the message else they mark them as spam or drop them entirely.
Bugzilla->params->{'urlbase'} has been moved to Bugzilla->localconfig->urlbase

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
- Strip path components from urlbase when building sitespec, as '/' is
  illegal after '@' in a Message-ID (affects both build_thread_marker
  and build_message_id)
- Fix stale $2 capture variable risk by conditioning port relocation on
  the substitution succeeding, in both functions
- Avoid falling back to Bugzilla->user->id in build_message_id, which
  is called from contexts with no logged-in user; random bits ensure
  uniqueness without a user identifier
- Remove trailing whitespace from the spam-guard comment and blank line
- Omit the user_id segment entirely when absent rather than producing
  a double-dash (bugzilla--rand@domain), giving bugzilla-rand@domain
Test the sitespec transformation for four urlbase forms (plain, with
path, with port, with port+path) to guard against regressions in the
'/' stripping and port relocation logic. Also covers user_id handling
in build_message_id (present, absent, no double-dash).
@mrenvoize

mrenvoize commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased, fixes for comments applied and unit test added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants