Skip to content

[Mailer] Modify SmtpTransport so that SentMessage contains Mailersend message id when that transport is used #60692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ovgray
Copy link
Contributor

@ovgray ovgray commented Jun 4, 2025

Q A
Branch? 6.4,
Bug fix? yes
Issues Fix #60678
License MIT

Change to regex in SmtpTransport::parseMessageId() so that it will capture Mailersend message id from $mtaResult.

(Hope I did this correctly).

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.4" but it seems your PR description refers to branch "6.4,".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbot
Copy link

It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you.

Cheers!

Carsonbot

@@ -156,7 +156,7 @@ protected function parseMessageId(string $mtaResult): string
{
$regexps = [
'/250 Ok (?P<id>[0-9a-f-]+)\r?$/mis',
'/250 Ok:? queued as (?P<id>[A-Z0-9]+)\r?$/mis',
'/250 (Ok:?|Message) queued as (?P<id>[a-fA-Z0-9]+)\r?$/mis',
Copy link
Contributor

Choose a reason for hiding this comment

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

There is already i (camelcase) flag

Suggested change
'/250 (Ok:?|Message) queued as (?P<id>[a-fA-Z0-9]+)\r?$/mis',
'/250 (Ok:?|Message) queued as (?P<id>[A-Z0-9]+)\r?$/mis',

@stof
Copy link
Member

stof commented Jun 4, 2025

Maybe a third regex should be added instead or modifying the second one.

@ovgray ovgray changed the base branch from 7.4 to 6.4 June 4, 2025 14:52
@@ -156,7 +156,7 @@ protected function parseMessageId(string $mtaResult): string
{
$regexps = [
'/250 Ok (?P<id>[0-9a-f-]+)\r?$/mis',
'/250 Ok:? queued as (?P<id>[A-Z0-9]+)\r?$/mis',
'/250 (Ok:?|Message) queued as (?P<id>[A-Z0-9a-f]+)\r?$/mis',
Copy link
Member

Choose a reason for hiding this comment

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

a-f is already covered by the A-Z range as we are matching case-insensitively.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thanks. Will modify.

@ovgray
Copy link
Contributor Author

ovgray commented Jun 5, 2025

I am closing this pull request and the related issue because having looked at 3 third-party transports now I have questions about the relationship between the message-id initially created by mailer, why it would or would not be modified by SmtpTransport, and how all that relates to the message id that ESPs use in their webhooks. If I can create a coherent statement of my questions, I will post it as a fresh issue.

@ovgray ovgray closed this Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mailer][Mailersend Mailer] Smtp - Changes Message-ID and changed id not returned by SentMessage->getMessageId()
4 participants