Skip to content

Make the SMTP connect timeout configurable - #38

Merged
TristanPouliquen merged 1 commit into
mainfrom
configurable-connect-timeout
Oct 2, 2026
Merged

TristanPouliquen merged 1 commit into
mainfrom
configurable-connect-timeout

Conversation

@TristanPouliquen

Copy link
Copy Markdown
Contributor

Summary

  • GenericProviderClient takes an optional last constructor argument, int $connectTimeout, and passes it to SMTP::connect(). check() used to call connect($mxServer) with no timeout, so PHPMailer's default of 30 s applied.
  • The default is GenericProviderClient::DEFAULT_CONNECT_TIMEOUT (30), which keeps today's behaviour, so this is a minor release (v2.12.0). A consumer whose MX servers are unreachable can now fail fast instead of waiting 30 s per server.
  • The SMTP connection is now built by a protected createConnection() method, so a test can substitute a recording SMTP. That is what GenericProviderClientTest does to pin both the default and a configured timeout.

Test plan

  • Fully covered by automated tests.

Shipping

Merging this PR ships nothing: it needs a semver tag / GitHub release (v2.12.0), then a
composer require assoconnect/php-smtp-toolbox:^2.12 bump PR in the consumer. Two reviews total.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

1 similar comment
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

@TristanPouliquen
TristanPouliquen merged commit dca30ce into main Oct 2, 2026
5 checks passed
@TristanPouliquen
TristanPouliquen deleted the configurable-connect-timeout branch October 2, 2026 13:23
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.

1 participant