Skip to content

Commit e767fd6

Browse files
[Mailer] Mailtrap sandbox changes
Suggested changes made as part of PR #61315.
1 parent c05d073 commit e767fd6

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
CHANGELOG
22
=========
33

4-
7.2
4+
7.4
55
---
66

7-
* Add the bridge
7+
* Add compatibility for Mailtrap's sandbox
88

9-
7.4
9+
7.2
1010
---
1111

12-
* Add compatibility for Mailtrap's sandbox
12+
* Add the bridge

src/Symfony/Component/Mailer/Bridge/Mailtrap/Transport/MailtrapApiTransport.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class MailtrapApiTransport extends AbstractApiTransport
3434
{
3535
private const HOST = 'send.api.mailtrap.io';
3636
private const HEADERS_TO_BYPASS = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender'];
37-
protected ?string $inboxId = null;
37+
private int $inboxId = 0;
3838

3939
public function __construct(
4040
#[\SensitiveParameter] private string $token,
@@ -50,9 +50,12 @@ public function __toString(): string
5050
return \sprintf('mailtrap+api://%s', $this->getEndpoint());
5151
}
5252

53-
public function setInboxId(?string $inboxId): static
53+
/**
54+
* @return $this
55+
*/
56+
public function setInboxId(mixed $inboxId): static
5457
{
55-
$this->inboxId = is_numeric( $inboxId ) ? $inboxId : null;
58+
$this->inboxId = (int) $inboxId;
5659

5760
return $this;
5861
}

src/Symfony/Component/Mailer/Bridge/Mailtrap/Transport/MailtrapTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function create(Dsn $dsn): TransportInterface
2929
if ('mailtrap+api' === $scheme) {
3030
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
3131
$port = $dsn->getPort();
32-
$inboxId = $dsn->getOption("inboxId");
32+
$inboxId = $dsn->getOption('inboxId');
3333

3434
return (new MailtrapApiTransport($user, $this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port)->setInboxId($inboxId);
3535
}

0 commit comments

Comments
 (0)