Skip to content

Commit 097107a

Browse files
driesvintstaylorotwellmichael-rubelJubeki
authored
[9.x] Implement Symfony Mailer (#38481)
* Implement Symfony Mailer * Apply fixes from StyleCI * Update src/Illuminate/Mail/Message.php Co-authored-by: michael-rubel <[email protected]> * Update src/Illuminate/Mail/Message.php Co-authored-by: michael-rubel <[email protected]> * Update src/Illuminate/Mail/Message.php Co-authored-by: michael-rubel <[email protected]> * Update src/Illuminate/Mail/Message.php Co-authored-by: michael-rubel <[email protected]> * Update src/Illuminate/Mail/Message.php Co-authored-by: michael-rubel <[email protected]> * Update Array and Log transports * Apply fixes from StyleCI * Fix interface implementation * Update Mailer * Apply fixes from StyleCI * Rename * Remove method * Fix tests * Apply fixes from StyleCI * Work on Mailer tests * type-hint * Fix Mailer tests * Fix more tests * Apply fixes from StyleCI * Migrate Mailgun transport * Migrate Postmark transport * Replace SesTransport * Remove transports from dev dependencies * Allow setting options on esmtp transport * Fix Postmark transport * Fix embedding files * Clarify API transports * Apply fixes from StyleCI * Fix SES transport setup * Add MessageStreamId to Postmark Transport again (#38748) * Update symfony mailer docblocks (#38773) * Update docblocks from Swift Mailer to Symfony Mailer * Make TransportInterface more specific * Add Session Token to SES Transport (#38797) * Update src/Illuminate/Mail/Transport/ArrayTransport.php Co-authored-by: Julius Kiekbusch <[email protected]> * fix docblock * Add Wrapper for Symfony SentMessage (#38803) * Create SentMessage wrapper for Symfony's SentMessage * Wrap Symfony SentMessage * Update Docblocks to Illuminate\Mail\SentMessage * Fix sendMailable * Update SentMessage.php Co-authored-by: Dries Vints <[email protected]> Co-authored-by: Taylor Otwell <[email protected]> Co-authored-by: michael-rubel <[email protected]> Co-authored-by: Julius Kiekbusch <[email protected]> Co-authored-by: Taylor Otwell <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent 3234a8d commit 097107a

27 files changed

+489
-1202
lines changed

composer.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"psr/container": "^1.1.1|^2.0.1",
3030
"psr/simple-cache": "^1.0",
3131
"ramsey/uuid": "^4.0",
32-
"swiftmailer/swiftmailer": "^6.2.7",
3332
"symfony/console": "^6.0",
3433
"symfony/error-handler": "^6.0",
3534
"symfony/finder": "^6.0",
3635
"symfony/http-foundation": "^6.0",
3736
"symfony/http-kernel": "^6.0",
37+
"symfony/mailer": "^6.0",
3838
"symfony/mime": "^6.0",
3939
"symfony/process": "^6.0",
4040
"symfony/routing": "^6.0",
@@ -136,12 +136,12 @@
136136
"ext-pcntl": "Required to use all features of the queue worker.",
137137
"ext-posix": "Required to use all features of the queue worker.",
138138
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
139-
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
139+
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).",
140140
"brianium/paratest": "Required to run tests in parallel (^6.0).",
141141
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
142142
"filp/whoops": "Required for friendly error pages in development (^2.8).",
143143
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
144-
"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).",
145145
"laravel/tinker": "Required to use the tinker console command (^2.0).",
146146
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^2.0).",
147147
"league/flysystem-ftp": "Required to use the Flysystem FTP driver (^2.0).",
@@ -153,10 +153,13 @@
153153
"predis/predis": "Required to use the predis connector (^1.1.2).",
154154
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
155155
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
156+
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
156157
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
157158
"symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).",
158-
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
159-
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
159+
"symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).",
160+
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
161+
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).",
162+
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)."
160163
},
161164
"config": {
162165
"sort-packages": true

src/Illuminate/Contracts/Mail/Mailer.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,4 @@ public function raw($text, $callback);
3838
* @return void
3939
*/
4040
public function send($view, array $data = [], $callback = null);
41-
42-
/**
43-
* Get the array of failed recipients.
44-
*
45-
* @return array
46-
*/
47-
public function failures();
4841
}

src/Illuminate/Mail/Events/MessageSending.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Illuminate\Mail\Events;
44

5+
use Symfony\Component\Mime\Email;
6+
57
class MessageSending
68
{
79
/**
8-
* The Swift message instance.
10+
* The Symfony Email instance.
911
*
10-
* @var \Swift_Message
12+
* @var \Symfony\Component\Mime\Email
1113
*/
1214
public $message;
1315

@@ -21,11 +23,11 @@ class MessageSending
2123
/**
2224
* Create a new event instance.
2325
*
24-
* @param \Swift_Message $message
26+
* @param \Symfony\Component\Mime\Email $message
2527
* @param array $data
2628
* @return void
2729
*/
28-
public function __construct($message, $data = [])
30+
public function __construct(Email $message, array $data = [])
2931
{
3032
$this->data = $data;
3133
$this->message = $message;

src/Illuminate/Mail/Events/MessageSent.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Illuminate\Mail\Events;
44

5-
use Swift_Attachment;
5+
use Symfony\Component\Mime\Email;
66

77
class MessageSent
88
{
99
/**
10-
* The Swift message instance.
10+
* The Symfony Email instance.
1111
*
12-
* @var \Swift_Message
12+
* @var \Symfony\Component\Mime\Email
1313
*/
1414
public $message;
1515

@@ -23,11 +23,11 @@ class MessageSent
2323
/**
2424
* Create a new event instance.
2525
*
26-
* @param \Swift_Message $message
26+
* @param \Symfony\Component\Mime\Email $message
2727
* @param array $data
2828
* @return void
2929
*/
30-
public function __construct($message, $data = [])
30+
public function __construct(Email $message, array $data = [])
3131
{
3232
$this->data = $data;
3333
$this->message = $message;
@@ -40,9 +40,7 @@ public function __construct($message, $data = [])
4040
*/
4141
public function __serialize()
4242
{
43-
$hasAttachments = collect($this->message->getChildren())
44-
->whereInstanceOf(Swift_Attachment::class)
45-
->isNotEmpty();
43+
$hasAttachments = collect($this->message->getAttachments())->isNotEmpty();
4644

4745
return $hasAttachments ? [
4846
'message' => base64_encode(serialize($this->message)),

0 commit comments

Comments
 (0)