Skip to content

Commit 3c25dce

Browse files
committed
Migrate Postmark transport
1 parent bd5f55d commit 3c25dce

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
"phpunit/phpunit": "^9.4",
9292
"predis/predis": "^1.1.2",
9393
"symfony/cache": "^6.0",
94-
"symfony/mailgun-mailer": "^6.0"
94+
"symfony/mailgun-mailer": "^6.0",
95+
"symfony/postmark-mailer": "^6.0"
9596
},
9697
"provide": {
9798
"psr/container-implementation": "1.0"
@@ -140,7 +141,7 @@
140141
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
141142
"filp/whoops": "Required for friendly error pages in development (^2.8).",
142143
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
143-
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",
144+
"guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.2).",
144145
"laravel/tinker": "Required to use the tinker console command (^2.0).",
145146
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^2.0).",
146147
"league/flysystem-ftp": "Required to use the Flysystem FTP driver (^2.0).",
@@ -154,10 +155,10 @@
154155
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
155156
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
156157
"symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).",
157-
"symfony/http-client": "Required to enable support for the Mailgun mail driver when using the https or api scheme (^6.0).",
158-
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail driver (^6.0).",
159-
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
160-
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
158+
"symfony/http-client": "Required to enable support for the Mailgun mail transport (^6.0).",
159+
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
160+
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).",
161+
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)."
161162
},
162163
"config": {
163164
"sort-packages": true

src/Illuminate/Mail/MailManager.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
use Illuminate\Support\Arr;
1313
use Illuminate\Support\Str;
1414
use InvalidArgumentException;
15-
use Postmark\Transport as PostmarkTransport;
1615
use Psr\Log\LoggerInterface;
1716
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
17+
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
1818
use Symfony\Component\Mailer\Transport\Dsn;
1919
use Symfony\Component\Mailer\Transport\FailoverTransport;
2020
use Symfony\Component\Mailer\Transport\SendmailTransport;
@@ -286,12 +286,6 @@ protected function createMailgunTransport(array $config)
286286
{
287287
$factory = new MailgunTransportFactory();
288288

289-
if (isset($config['dsn'])) {
290-
return $factory->create(
291-
Dsn::fromString($config['dsn'])
292-
);
293-
}
294-
295289
if (! isset($config['secret'])) {
296290
$config = $this->app['config']->get('services.mailgun', []);
297291
}
@@ -312,14 +306,13 @@ protected function createMailgunTransport(array $config)
312306
*/
313307
protected function createPostmarkTransport(array $config)
314308
{
315-
$headers = isset($config['message_stream_id']) ? [
316-
'X-PM-Message-Stream' => $config['message_stream_id'],
317-
] : [];
309+
$factory = new PostmarkTransportFactory();
318310

319-
return new PostmarkTransport(
320-
$config['token'] ?? $this->app['config']->get('services.postmark.token'),
321-
$headers
322-
);
311+
return $factory->create(new Dsn(
312+
'postmark+api',
313+
'default',
314+
$config['token']
315+
));
323316
}
324317

325318
/**

src/Illuminate/Mail/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.189.0).",
4141
"symfony/http-client": "Required to use the Mailgun mail driver (^6.0).",
4242
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail driver (^6.0).",
43-
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
43+
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0)."
4444
},
4545
"config": {
4646
"sort-packages": true

0 commit comments

Comments
 (0)