Skip to content

[Mailer] Add compatibility for Mailtrap's sandbox #61315

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

Open
wants to merge 5 commits into
base: 7.4
Choose a base branch
from

Conversation

KiloSierraCharlie
Copy link

Mailtrap's sandbox requires the Inbox ID to be passed as part of the URI, which has previously been neglected.

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues n/a
License MIT

Previously #61305 but I messed up when re-basing to 7.4.

Updates with appropriate tests and changelog.

Mailtrap's sandbox requires the Inbox ID to be passed as part of the URI, which has previously been neglected.
Correct setter function for inbox id within the transport factory test.
Spelling mistake made with changelog for sandbox compatibility.
@KiloSierraCharlie
Copy link
Author

Sorry about that @Chris53897. Mistake resolved with commit.

@@ -34,6 +34,7 @@ final class MailtrapApiTransport extends AbstractApiTransport
{
private const HOST = 'send.api.mailtrap.io';
private const HEADERS_TO_BYPASS = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender'];
protected ?string $inboxId = null;
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
protected ?string $inboxId = null;
private int $inboxId = 0;

Comment on lines +53 to +55
public function setInboxId(?string $inboxId): static
{
$this->inboxId = is_numeric( $inboxId ) ? $inboxId : null;
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
public function setInboxId(?string $inboxId): static
{
$this->inboxId = is_numeric( $inboxId ) ? $inboxId : null;
/**
* @return $this
*/
public function setInboxId(int $inboxId): static
{
$this->inboxId = $inboxId;

Copy link
Author

Choose a reason for hiding this comment

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

As the DSN getOption() func returns a mixed value, should this not be type-casted to int?

KiloSierraCharlie and others added 2 commits August 5, 2025 11:02
Swap order of 7.3 and 7.4 within changelog.

Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Cleaner method of forming URI for sandbox.

Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
@@ -29,8 +29,9 @@ public function create(Dsn $dsn): TransportInterface
if ('mailtrap+api' === $scheme) {
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
$port = $dsn->getPort();
$inboxId = $dsn->getOption("inboxId");
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
$inboxId = $dsn->getOption("inboxId");
$inboxId = $dsn->getOption('inboxId');

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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy