-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[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
base: 7.4
Are you sure you want to change the base?
[Mailer] Add compatibility for Mailtrap's sandbox #61315
Conversation
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.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected ?string $inboxId = null; | |
private int $inboxId = 0; |
public function setInboxId(?string $inboxId): static | ||
{ | ||
$this->inboxId = is_numeric( $inboxId ) ? $inboxId : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function setInboxId(?string $inboxId): static | |
{ | |
$this->inboxId = is_numeric( $inboxId ) ? $inboxId : null; | |
/** | |
* @return $this | |
*/ | |
public function setInboxId(int $inboxId): static | |
{ | |
$this->inboxId = $inboxId; |
There was a problem hiding this comment.
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?
src/Symfony/Component/Mailer/Bridge/Mailtrap/Transport/MailtrapApiTransport.php
Outdated
Show resolved
Hide resolved
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$inboxId = $dsn->getOption("inboxId"); | |
$inboxId = $dsn->getOption('inboxId'); |
Mailtrap's sandbox requires the Inbox ID to be passed as part of the URI, which has previously been neglected.
Previously #61305 but I messed up when re-basing to 7.4.
Updates with appropriate tests and changelog.