Skip to content

Conversation

@adars47
Copy link

@adars47 adars47 commented Oct 10, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #62024
License MIT

This feature addresses feature request on #62024
User's now have ability to select a different port when using ses+smtp

It takes the port from DSN and backward compatiblity is maintained by passing 465 as the default parameter.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Please rebase to get rid of the merge commit (you can squash while doing so)

}

parent::__construct($host, 465, true, $dispatcher, $logger);
parent::__construct($host, $port, true, $dispatcher, $logger);
Copy link
Member

Choose a reason for hiding this comment

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

The $tls argument must now depend on the port I guess so that it is false when the given port mandates using STARTTLS.

That said should we also limit the accepted ports to the ones listed in the linked issue?

Copy link
Author

@adars47 adars47 Oct 19, 2025

Choose a reason for hiding this comment

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

@xabbuh That makes sense.

Changes made:
If the user provides wether or not to use tls, it will be respected.
If the user does not define tls in the DSN, it will use AWS's mapping to make sense of it:
465 or 2465 = TLS
25, 587, or 2587 = STARTTLS

However, we should not lock them to accepted ports as specified by AWS, because the client's can use port mapping to forward 25 -> 465 because 25 was taken.

Edge case? Sure, but giving the user's flexbility to choose wether to use tls or which port to use seem like the correct choice here. With a fallback working the way you explained it ( if no port or tls configurations are made ).

@adars47 adars47 force-pushed the Mailer-Bridge-Amazon-SMTPAllowPortSelection branch from fb27adf to 6afe2a4 Compare October 19, 2025 13:18
@adars47 adars47 requested a review from chalasr as a code owner October 19, 2025 13:18
@adars47 adars47 marked this pull request as draft October 19, 2025 13:34
@adars47 adars47 force-pushed the Mailer-Bridge-Amazon-SMTPAllowPortSelection branch 2 times, most recently from c34c3ab to 536decd Compare October 19, 2025 13:50
@adars47 adars47 marked this pull request as ready for review October 19, 2025 13:58
@nicolas-grekas nicolas-grekas changed the title [Mailer][Mailer-Bridge-Amazon-SMTPAllowPortSelection] Allow port selection #62026 [Mailer] Allow configuring port and tls options when using the Amazon SES bridge Nov 14, 2025
@nicolas-grekas nicolas-grekas force-pushed the Mailer-Bridge-Amazon-SMTPAllowPortSelection branch from 536decd to 914d3ad Compare November 14, 2025 13:56
@nicolas-grekas nicolas-grekas force-pushed the Mailer-Bridge-Amazon-SMTPAllowPortSelection branch from 914d3ad to 65d3bcb Compare November 14, 2025 13:58
Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

I have some suggestions to make it easier for consumers to not shoot themselves in the foot.

adars47 and others added 2 commits November 14, 2025 20:53
…ansport.php

Co-authored-by: Christian Flothmann <christian.flothmann@gmail.com>
…ansport.php

Co-authored-by: Christian Flothmann <christian.flothmann@gmail.com>
…ansport.php

Co-authored-by: Christian Flothmann <christian.flothmann@gmail.com>
{
if (!\in_array($port, [], true)) {
throw new InvalidArgumentException(\sprintf('The port must be one of [25, 587, 2587, 465, 2465] (%d given).', $port);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
throw new InvalidArgumentException(\sprintf('The port must be one of [25, 587, 2587, 465, 2465] (%d given).', $port);
throw new InvalidArgumentException(\sprintf('The port must be one of [25, 587, 2587, 465, 2465] (%d given).', $port));

@nicolas-grekas nicolas-grekas modified the milestones: 7.4, 8.1 Nov 16, 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.

Allow port selection Mailer/bridge/Amazon

4 participants