|
4 | 4 |
|
5 | 5 | use Aws\SesV2\SesV2Client; |
6 | 6 | use Closure; |
7 | | -use GuzzleHttp\Client as HttpClient; |
8 | 7 | use Illuminate\Contracts\Mail\Factory as FactoryContract; |
9 | 8 | use Illuminate\Log\LogManager; |
10 | 9 | use Illuminate\Mail\Transport\ArrayTransport; |
11 | 10 | use Illuminate\Mail\Transport\LogTransport; |
12 | | -use Illuminate\Mail\Transport\MailgunTransport; |
13 | 11 | use Illuminate\Mail\Transport\SesTransport; |
14 | 12 | use Illuminate\Support\Arr; |
15 | 13 | use Illuminate\Support\Str; |
16 | 14 | use InvalidArgumentException; |
17 | 15 | use Postmark\Transport as PostmarkTransport; |
18 | 16 | use Psr\Log\LoggerInterface; |
| 17 | +use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory; |
| 18 | +use Symfony\Component\Mailer\Transport\Dsn; |
19 | 19 | use Symfony\Component\Mailer\Transport\FailoverTransport; |
20 | 20 | use Symfony\Component\Mailer\Transport\SendmailTransport; |
21 | 21 | use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; |
@@ -280,20 +280,28 @@ protected function createMailTransport() |
280 | 280 | * Create an instance of the Mailgun Swift Transport driver. |
281 | 281 | * |
282 | 282 | * @param array $config |
283 | | - * @return \Illuminate\Mail\Transport\MailgunTransport |
| 283 | + * @return \Symfony\Component\Mailer\Transport\TransportInterface |
284 | 284 | */ |
285 | 285 | protected function createMailgunTransport(array $config) |
286 | 286 | { |
| 287 | + $factory = new MailgunTransportFactory(); |
| 288 | + |
| 289 | + if (isset($config['dsn'])) { |
| 290 | + return $factory->create( |
| 291 | + Dsn::fromString($config['dsn']) |
| 292 | + ); |
| 293 | + } |
| 294 | + |
287 | 295 | if (! isset($config['secret'])) { |
288 | 296 | $config = $this->app['config']->get('services.mailgun', []); |
289 | 297 | } |
290 | 298 |
|
291 | | - return new MailgunTransport( |
292 | | - $this->guzzle($config), |
| 299 | + return $factory->create(new Dsn( |
| 300 | + 'mailgun+api', |
| 301 | + $config['endpoint'] ?? 'default', |
293 | 302 | $config['secret'], |
294 | | - $config['domain'], |
295 | | - $config['endpoint'] ?? null |
296 | | - ); |
| 303 | + $config['domain'] |
| 304 | + )); |
297 | 305 | } |
298 | 306 |
|
299 | 307 | /** |
@@ -371,21 +379,6 @@ protected function createArrayTransport() |
371 | 379 | return new ArrayTransport; |
372 | 380 | } |
373 | 381 |
|
374 | | - /** |
375 | | - * Get a fresh Guzzle HTTP client instance. |
376 | | - * |
377 | | - * @param array $config |
378 | | - * @return \GuzzleHttp\Client |
379 | | - */ |
380 | | - protected function guzzle(array $config) |
381 | | - { |
382 | | - return new HttpClient(Arr::add( |
383 | | - $config['guzzle'] ?? [], |
384 | | - 'connect_timeout', |
385 | | - 60 |
386 | | - )); |
387 | | - } |
388 | | - |
389 | 382 | /** |
390 | 383 | * Set a global address on the mailer by type. |
391 | 384 | * |
|
0 commit comments