8000 [Mailer] Removes the default resource name and fixes the exception me… · symfony/symfony@89badda · GitHub
[go: up one dir, main page]

Skip to content

Commit 89badda

Browse files
committed
[Mailer] Removes the default resource name and fixes the exception message in Azure Bridge
1 parent 1462dfe commit 89badda

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Symfony/Component/Mailer/Bridge/Azure/Transport/AzureApiTransport.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Mailer\Bridge\Azure\Transport;
1313

14-
use Exception;
1514
use Psr\EventDispatcher\EventDispatcherInterface;
1615
use Psr\Log\LoggerInterface;
1716
use Symfony\Component\Mailer\Envelope;
@@ -52,10 +51,10 @@ final class AzureApiTransport extends AbstractApiTransport
5251

5352
public function __construct(string $key, string $resourceName, bool $engagementTracking = true, string $apiVersion = '2023-03-31', HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
5453
{
55-
if(str_contains($resourceName, '.') || str_ends_with($resourceName, '.')) {
56-
throw new Exception('Resource name cannot be ends with dot.');
54+
if (str_contains($resourceName, '.') || str_ends_with($resourceName, '.')) {
55+
throw new \Exception('Resource name cannot contain or end with a dot');
5756
}
58-
57+
5958
$this->resourceName = $resourceName;
6059
$this->key = $key;
6160
$this->apiVersion = $apiVersion;
@@ -180,7 +179,7 @@ private function getMessageAttachments(Email $email): array
180179
*/
181180
private function getAzureCSEndpoint(): string
182181
{
183-
return !empty($this->host) ? $this->host : sprintf(self::HOST, $this->resourceName ?: 'my-acs-resource-name');
182+
return !empty($this->host) ? $this->host : sprintf(self::HOST, $this->resourceName);
184183
}
185184

186185
private function generateContentHash(string $content): string

0 commit comments

Comments
 (0)
0