Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d484d69

Browse files
[Mailer] Reflect sandbox state in MailjetApiTransport::__toString()
1 parent 624fd95 commit d484d69

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetApiTransportTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public static function getTransportData()
4545
(new MailjetApiTransport(self::USER, self::PASSWORD))->setHost('example.com'),
4646
'mailjet+api://example.com',
4747
],
48+
[
49+
(new MailjetApiTransport(self::USER, self::PASSWORD, sandbox: true))->setHost('example.com'),
50+
'mailjet+api://example.com?sandbox=true',
51+
]
4852
];
4953
}
5054

src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(string $publicKey, string $privateKey, HttpClientInt
6666

6767
public function __toString(): string
6868
{
69-
return sprintf('mailjet+api://%s', $this->getEndpoint());
69+
return sprintf('mailjet+api://%s', $this->getEndpoint().($this->sandbox ? '?sandbox=true' : ''));
7070
}
7171

7272
protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $envelope): ResponseInterface

0 commit comments

Comments
 (0)