Skip to content

Commit

Permalink
[9.x] Implement Symfony Mailer (#38481)
Browse files Browse the repository at this point in the history
* Implement Symfony Mailer

* Apply fixes from StyleCI

* Update src/Illuminate/Mail/Message.php

Co-authored-by: michael-rubel <contact@observer.name>

* Update src/Illuminate/Mail/Message.php

Co-authored-by: michael-rubel <contact@observer.name>

* Update src/Illuminate/Mail/Message.php

Co-authored-by: michael-rubel <contact@observer.name>

* Update src/Illuminate/Mail/Message.php

Co-authored-by: michael-rubel <contact@observer.name>

* Update src/Illuminate/Mail/Message.php

Co-authored-by: michael-rubel <contact@observer.name>

* 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 <jubeki99@gmail.com>

* 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 <dries@vints.io>

Co-authored-by: Taylor Otwell <taylorotwell@users.noreply.github.com>
Co-authored-by: michael-rubel <contact@observer.name>
Co-authored-by: Julius Kiekbusch <jubeki99@gmail.com>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
  • Loading branch information
6 people authored Sep 14, 2021
1 parent 3234a8d commit 097107a
Show file tree
Hide file tree
Showing 27 changed files with 489 additions and 1,202 deletions.
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"psr/container": "^1.1.1|^2.0.1",
"psr/simple-cache": "^1.0",
"ramsey/uuid": "^4.0",
"swiftmailer/swiftmailer": "^6.2.7",
"symfony/console": "^6.0",
"symfony/error-handler": "^6.0",
"symfony/finder": "^6.0",
"symfony/http-foundation": "^6.0",
"symfony/http-kernel": "^6.0",
"symfony/mailer": "^6.0",
"symfony/mime": "^6.0",
"symfony/process": "^6.0",
"symfony/routing": "^6.0",
Expand Down Expand Up @@ -136,12 +136,12 @@
"ext-pcntl": "Required to use all features of the queue worker.",
"ext-posix": "Required to use all features of the queue worker.",
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).",
"brianium/paratest": "Required to run tests in parallel (^6.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",
"guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.2).",
"laravel/tinker": "Required to use the tinker console command (^2.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^2.0).",
"league/flysystem-ftp": "Required to use the Flysystem FTP driver (^2.0).",
Expand All @@ -153,10 +153,13 @@
"predis/predis": "Required to use the predis connector (^1.1.2).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
"symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).",
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
"symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).",
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).",
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)."
},
"config": {
"sort-packages": true
Expand Down
7 changes: 0 additions & 7 deletions src/Illuminate/Contracts/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,4 @@ public function raw($text, $callback);
* @return void
*/
public function send($view, array $data = [], $callback = null);

/**
* Get the array of failed recipients.
*
* @return array
*/
public function failures();
}
10 changes: 6 additions & 4 deletions src/Illuminate/Mail/Events/MessageSending.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

namespace Illuminate\Mail\Events;

use Symfony\Component\Mime\Email;

class MessageSending
{
/**
* The Swift message instance.
* The Symfony Email instance.
*
* @var \Swift_Message
* @var \Symfony\Component\Mime\Email
*/
public $message;

Expand All @@ -21,11 +23,11 @@ class MessageSending
/**
* Create a new event instance.
*
* @param \Swift_Message $message
* @param \Symfony\Component\Mime\Email $message
* @param array $data
* @return void
*/
public function __construct($message, $data = [])
public function __construct(Email $message, array $data = [])
{
$this->data = $data;
$this->message = $message;
Expand Down
14 changes: 6 additions & 8 deletions src/Illuminate/Mail/Events/MessageSent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Illuminate\Mail\Events;

use Swift_Attachment;
use Symfony\Component\Mime\Email;

class MessageSent
{
/**
* The Swift message instance.
* The Symfony Email instance.
*
* @var \Swift_Message
* @var \Symfony\Component\Mime\Email
*/
public $message;

Expand All @@ -23,11 +23,11 @@ class MessageSent
/**
* Create a new event instance.
*
* @param \Swift_Message $message
* @param \Symfony\Component\Mime\Email $message
* @param array $data
* @return void
*/
public function __construct($message, $data = [])
public function __construct(Email $message, array $data = [])
{
$this->data = $data;
$this->message = $message;
Expand All @@ -40,9 +40,7 @@ public function __construct($message, $data = [])
*/
public function __serialize()
{
$hasAttachments = collect($this->message->getChildren())
->whereInstanceOf(Swift_Attachment::class)
->isNotEmpty();
$hasAttachments = collect($this->message->getAttachments())->isNotEmpty();

return $hasAttachments ? [
'message' => base64_encode(serialize($this->message)),
Expand Down
Loading

0 comments on commit 097107a

Please sign in to comment.