Skip to content

Commit

Permalink
Update MailgunSwiftTransport.php
Browse files Browse the repository at this point in the history
Updated SimpleMessage class
  • Loading branch information
Linkdup committed Oct 12, 2021
1 parent fe5d287 commit 9da49f0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/MailgunSwiftTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace LeKoala\Mailgun;

use \Exception;
use \Swift_Mime_SimpleMessage;
use \Swift_MimePart;
use \Swift_Transport;
use \Swift_Attachment;
use \Swift_Mime_Message;
use \Swift_Mime_SimpleMessage;
use \Swift_Events_SendEvent;
use \Swift_Events_EventListener;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -94,7 +93,7 @@ public function ping()
}

/**
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @param null $failedRecipients
* @return int Number of messages sent
*/
Expand Down Expand Up @@ -171,12 +170,12 @@ public function send(
/**
* Log message content
*
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @param array $results Results from the api
* @return void
*/
protected function logMessageContent(
Swift_Mime_Message $message,
Swift_Mime_SimpleMessage $message,
$results = []
) {
$subject = $message->getSubject();
Expand Down Expand Up @@ -290,18 +289,19 @@ protected function supportsContentType($contentType)
}

/**
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @return string
*/
protected function getMessagePrimaryContentType(Swift_Mime_Message $message)
{
protected function getMessagePrimaryContentType(
Swift_Mime_SimpleMessage $message
) {
$contentType = $message->getContentType();

if ($this->supportsContentType($contentType)) {
return $contentType;
}

// SwiftMailer hides the content type set in the constructor of Swift_Mime_Message as soon
// SwiftMailer hides the content type set in the constructor of Swift_Mime_SimpleMessage as soon
// as you add another part to the message. We need to access the protected property
// _userContentType to get the original type.
$messageRef = new \ReflectionClass($message);
Expand All @@ -317,11 +317,11 @@ protected function getMessagePrimaryContentType(Swift_Mime_Message $message)
/**
* Convert a Swift Message for the api
*
* @param Swift_Mime_Message $message
* @param Swift_Mime_SimpleMessage $message
* @return array Mailgun Send Message
* @throws \Swift_SwiftException
*/
public function buildMessage(Swift_Mime_Message $message)
public function buildMessage(Swift_Mime_SimpleMessage $message)
{
$contentType = $this->getMessagePrimaryContentType($message);

Expand Down

0 comments on commit 9da49f0

Please sign in to comment.