Skip to content

Commit

Permalink
Support for Swiftmailer 6 & Laravel 5.5 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravin001 authored and Lidbetter committed Dec 1, 2017
1 parent 2d4dfe4 commit 2f2a5d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"illuminate/container": ">=5.0",
"swiftmailer/swiftmailer": "~5.1"
"swiftmailer/swiftmailer": "~6.0"
},
"autoload": {
"psr-4": {
Expand Down
38 changes: 19 additions & 19 deletions src/Transport/SendgridTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Swift_Image;
use Swift_MimePart;
use Swift_Attachment;
use Swift_Mime_Message;
use Swift_Mime_SimpleMessage;
use GuzzleHttp\ClientInterface;
use Illuminate\Mail\Transport\Transport;

Expand All @@ -31,12 +31,12 @@ public function __construct(ClientInterface $client, $api_key)
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
list($from, $fromName) = $this->getFromAddresses($message);
$payload = $this->options;
Expand All @@ -62,9 +62,9 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)
}
/**
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setTo(&$data, Swift_Mime_Message $message)
protected function setTo(&$data, Swift_Mime_SimpleMessage $message)
{
if ($to = $message->getTo()) {
$data['to'] = array_keys($to);
Expand All @@ -73,9 +73,9 @@ protected function setTo(&$data, Swift_Mime_Message $message)
}
/**
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setCc(&$data, Swift_Mime_Message $message)
protected function setCc(&$data, Swift_Mime_SimpleMessage $message)
{
if ($cc = $message->getCc()) {
$data['cc'] = array_keys($cc);
Expand All @@ -84,9 +84,9 @@ protected function setCc(&$data, Swift_Mime_Message $message)
}
/**
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setBcc(&$data, Swift_Mime_Message $message)
protected function setBcc(&$data, Swift_Mime_SimpleMessage $message)
{
if ($bcc = $message->getBcc()) {
$data['bcc'] = array_keys($bcc);
Expand All @@ -95,9 +95,9 @@ protected function setBcc(&$data, Swift_Mime_Message $message)
}
/**
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setReplyTo(&$data, Swift_Mime_Message $message)
protected function setReplyTo(&$data, Swift_Mime_SimpleMessage $message)
{
if ($replyTo = $message->getReplyTo()) {
$data['replyto'] = array_keys($replyTo);
Expand All @@ -107,10 +107,10 @@ protected function setReplyTo(&$data, Swift_Mime_Message $message)
/**
* Get From Addresses.
*
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @return array
*/
protected function getFromAddresses(Swift_Mime_Message $message)
protected function getFromAddresses(Swift_Mime_SimpleMessage $message)
{
if ($message->getFrom()) {
foreach ($message->getFrom() as $address => $name) {
Expand All @@ -123,9 +123,9 @@ protected function getFromAddresses(Swift_Mime_Message $message)
* Set text contents.
*
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setText(&$data, Swift_Mime_Message $message)
protected function setText(&$data, Swift_Mime_SimpleMessage $message)
{
foreach ($message->getChildren() as $attachment) {
if (!$attachment instanceof Swift_MimePart) {
Expand All @@ -138,9 +138,9 @@ protected function setText(&$data, Swift_Mime_Message $message)
* Set Attachment Files.
*
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setAttachment(&$data, Swift_Mime_Message $message)
protected function setAttachment(&$data, Swift_Mime_SimpleMessage $message)
{
foreach ($message->getChildren() as $attachment) {
if (!$attachment instanceof Swift_Attachment || !strlen($attachment->getBody()) > self::MAXIMUM_FILE_SIZE) {
Expand All @@ -155,9 +155,9 @@ protected function setAttachment(&$data, Swift_Mime_Message $message)
* Set Sendgrid SMTP API
*
* @param $data
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
*/
protected function setSmtpApi(&$data, Swift_Mime_Message $message)
protected function setSmtpApi(&$data, Swift_Mime_SimpleMessage $message)
{
foreach ($message->getChildren() as $attachment) {
if (!$attachment instanceof Swift_Image
Expand Down

0 comments on commit 2f2a5d5

Please sign in to comment.