|
8 | 8 |
|
9 | 9 | trait CreatesMailers |
10 | 10 | { |
11 | | - protected function createLaravel6Mailer($app) |
12 | | - { |
13 | | - $config = $this->getConfig(); |
14 | | - |
15 | | - // Once we have create the mailer instance, we will set a container instance |
16 | | - // on the mailer. This allows us to resolve mailer classes via containers |
17 | | - // for maximum testability on said classes instead of passing Closures. |
18 | | - $mailer = new Mailer( |
19 | | - $app['view'], |
20 | | - $app['swift.mailer'], |
21 | | - $app['events'] |
22 | | - ); |
23 | | - |
24 | | - if ($app->bound('queue')) { |
25 | | - $mailer->setQueue($app['queue']); |
26 | | - } |
27 | | - |
28 | | - // Next we will set all of the global addresses on this mailer, which allows |
29 | | - // for easy unification of all "from" addresses as well as easy debugging |
30 | | - // of sent messages since they get be sent into a single email address. |
31 | | - foreach (['from', 'reply_to', 'to'] as $type) { |
32 | | - $this->setGlobalAddress($mailer, $config, $type); |
33 | | - } |
34 | | - |
35 | | - return $mailer; |
36 | | - } |
37 | | - |
38 | | - protected function createLaravel7Mailer($app) |
39 | | - { |
40 | | - $defaultDriver = $app['mail.manager']->getDefaultDriver(); |
41 | | - $config = $this->getConfig($defaultDriver); |
42 | | - |
43 | | - // Laravel 7 no longer bindes the swift.mailer: |
44 | | - $swiftMailer = new Swift_Mailer($app['mail.manager']->createTransport($config)); |
45 | | - |
46 | | - // Once we have create the mailer instance, we will set a container instance |
47 | | - // on the mailer. This allows us to resolve mailer classes via containers |
48 | | - // for maximum testability on said classes instead of passing Closures. |
49 | | - $mailer = new Laravel7Mailer( |
50 | | - 'smtp', |
51 | | - $app['view'], |
52 | | - $swiftMailer, |
53 | | - $app['events'] |
54 | | - ); |
55 | | - |
56 | | - if ($app->bound('queue')) { |
57 | | - $mailer->setQueue($app['queue']); |
58 | | - } |
59 | | - |
60 | | - // Next we will set all of the global addresses on this mailer, which allows |
61 | | - // for easy unification of all "from" addresses as well as easy debugging |
62 | | - // of sent messages since they get be sent into a single email address. |
63 | | - foreach (['from', 'reply_to', 'to', 'return_path'] as $type) { |
64 | | - $this->setGlobalAddress($mailer, $config, $type); |
65 | | - } |
66 | | - |
67 | | - return $mailer; |
68 | | - } |
69 | 11 |
|
70 | 12 | protected function createLaravel8Mailer($app) |
71 | 13 | { |
|
0 commit comments