-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
76 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,23 +5,24 @@ | |
* http://www.magepal.com | [email protected] | ||
*/ | ||
|
||
namespace MagePal\CustomSmtp\Mail\ZF2; | ||
namespace MagePal\CustomSmtp\Mail; | ||
|
||
use Exception; | ||
use Laminas\Mail\AddressList; | ||
use Laminas\Mail\Header\HeaderInterface; | ||
use Laminas\Mail\Message; | ||
use Laminas\Mail\Transport\Smtp as SmtpTransport; | ||
use Laminas\Mail\Transport\SmtpOptions; | ||
use Laminas\Mime\Mime; | ||
use Magento\Framework\Exception\MailException; | ||
use Magento\Framework\Mail\EmailMessageInterface; | ||
use Magento\Framework\Mail\MessageInterface; | ||
use Magento\Framework\Phrase; | ||
use MagePal\CustomSmtp\Helper\Data; | ||
use MagePal\CustomSmtp\Model\Store; | ||
use Zend\Mail\AddressList; | ||
use Zend\Mail\Message; | ||
use Zend\Mail\Transport\Smtp as SmtpTransport; | ||
use Zend\Mail\Transport\SmtpOptions; | ||
|
||
/** | ||
* Class Smtp | ||
* For Magento >= 2.2.8 | ||
*/ | ||
class Smtp | ||
{ | ||
|
@@ -96,7 +97,9 @@ protected function convertMessage($message) | |
} | ||
|
||
if (!$zendMessage instanceof Message) { | ||
throw new MailException('Not instance of Message'); | ||
throw new MailException( | ||
__('Not instance of Message') | ||
); | ||
} | ||
} catch (Exception $e) { | ||
$zendMessage = Message::fromString($message->getRawMessage()); | ||
|
@@ -125,7 +128,7 @@ public function sendSmtpMessage( | |
|
||
foreach ($message->getHeaders()->toArray() as $headerKey => $headerValue) { | ||
$mailHeader = $message->getHeaders()->get($headerKey); | ||
if ($mailHeader instanceof \Zend\Mail\Header\HeaderInterface) { | ||
if ($mailHeader instanceof HeaderInterface) { | ||
$this->updateMailHeader($mailHeader); | ||
} elseif ($mailHeader instanceof \ArrayIterator) { | ||
foreach ($mailHeader as $header) { | ||
|
@@ -147,6 +150,7 @@ public function sendSmtpMessage( | |
} | ||
|
||
/** | ||
* | ||
* @param Message $message | ||
*/ | ||
protected function setSender($message) | ||
|
@@ -259,8 +263,8 @@ protected function getSmtpOptions() | |
*/ | ||
public function updateMailHeader($header) | ||
{ | ||
if ($header instanceof \Zend\Mail\Header\HeaderInterface) { | ||
if (\Zend\Mime\Mime::isPrintable($header->getFieldValue())) { | ||
if ($header instanceof HeaderInterface) { | ||
if (Mime::isPrintable($header->getFieldValue())) { | ||
$header->setEncoding('ASCII'); | ||
} else { | ||
$header->setEncoding('utf-8'); | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.