Skip to content

Commit

Permalink
[BUGFIX] di compile error fix, non excisting email/transport class
Browse files Browse the repository at this point in the history
  • Loading branch information
Derrick Heesbeen authored and Derrick Heesbeen committed Jan 18, 2018
1 parent 8d02617 commit b07dab7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
36 changes: 33 additions & 3 deletions Mail/Transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@
namespace Experius\EmailCatcher\Mail;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Mail\MessageInterface;
use Magento\Framework\Mail\TransportInterface;
use Magento\Store\Model\ScopeInterface;

class Transport extends \Magento\Email\Model\Transport
class Transport implements TransportInterface
{

const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';

const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';

private $transport;

private $message;
Expand All @@ -35,17 +42,40 @@ public function __construct(
$this->transport = $transport;
$this->message = $message;
$this->scopeConfig = $scopeConfig;

parent::__construct($transport, $message, $scopeConfig);
}

public function setMessage(\Magento\Framework\Mail\Message $message)
{
$this->message = $message;
}

public function sendMessage()
{
try {

$isSetReturnPath = $this->scopeConfig->getValue(
self::XML_PATH_SENDING_SET_RETURN_PATH,
ScopeInterface::SCOPE_STORE
);
$returnPathValue = $this->scopeConfig->getValue(
self::XML_PATH_SENDING_RETURN_PATH_EMAIL,
ScopeInterface::SCOPE_STORE
);

if ($isSetReturnPath == '1') {
$this->message->setReturnPath($this->message->getFrom());
} elseif ($isSetReturnPath == '2' && $returnPathValue !== null) {
$this->message->setReturnPath($returnPathValue);
}
$this->transport->send($this->message);
} catch (\Exception $e) {
throw new MailException(__($e->getMessage()), $e);
}
}

public function getMessage()
{
return $this->message;
}
}

4 changes: 2 additions & 2 deletions view/adminhtml/ui_component/experius_emailcatcher_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<bookmark name="bookmarks"/>
<columnsControls name="columns_controls"/>
<filters name="listing_filters"/>
<massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">
<!--<massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">-->
<!--<action name="forward">-->
<!--<settings>-->
<!--<url path="*/*/forward"/>-->
Expand All @@ -64,7 +64,7 @@
<!--<label translate="true">Delete</label>-->
<!--</settings>-->
<!--</action>-->
</massaction>
<!--</massaction>-->
<paging name="listing_paging"/>
</listingToolbar>
<columns name="experius_emailcatcher_columns">
Expand Down

0 comments on commit b07dab7

Please sign in to comment.