Skip to content

Commit

Permalink
Add Support for Magento 2.4.6 and PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
srenon committed Mar 16, 2023
1 parent 6429d48 commit b808489
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 77 deletions.
1 change: 0 additions & 1 deletion Mail/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* Class Smtp
* For Magento <= 2.2.7
*/
class Smtp
{
Expand Down
62 changes: 0 additions & 62 deletions Model/Transport.php

This file was deleted.

5 changes: 5 additions & 0 deletions Plugin/Mail/TransportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Framework\Mail\Message;
use Magento\Framework\Mail\TransportInterface;
use MagePal\CustomSmtp\Helper\Data;
use MagePal\CustomSmtp\Mail\SmtpFactory;
use MagePal\CustomSmtp\Mail\Smtp;
use MagePal\CustomSmtp\Model\Store;

Expand All @@ -27,6 +28,9 @@ class TransportPlugin
* @var Store
*/
protected $storeModel;
/**
* @var Smtp
*/
private SmtpFactory $smtpFactory;

/**
Expand Down Expand Up @@ -60,6 +64,7 @@ public function aroundSendMessage(
$message = $subject->getMessage();

if ($message instanceof Message || $message instanceof EmailMessageInterface) {
/** @var Smtp $smtp */
$smtp = $this->smtpFactory->create(
['dataHelper' => $this->dataHelper, 'storeModel' => $this->storeModel]
);
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"how to setup email magento2"
],
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6|~7.1.0|~7.1.3|~7.2.0|~7.3.0|~7.4.0|~8.1.0",
"magento/module-backend": "100.0.*|100.1.*|100.2.*|101.0.*|102.0.*",
"magento/framework": "100.0.*|100.1.*|101.0.*|102.0.*|103.0.*",
"magepal/magento2-core": ">=1.1.11"
"php": "~7.4.0||~8.1.0||~8.2.0",
"magento/module-backend": "102.0.*",
"magento/framework": "103.0.*",
"magepal/magento2-core":">=1.1.11"
},
"license": [
"proprietary"
Expand Down
7 changes: 0 additions & 7 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- For Magento < 2.2 -->
<preference for="Magento\Framework\Mail\Transport" type="MagePal\CustomSmtp\Model\Transport"/>
<type name="MagePal\CustomSmtp\Model\Transport">
<plugin sortOrder="100" name="magePalCustomSmtpTransport" type="MagePal\CustomSmtp\Plugin\Mail\TransportPlugin"/>
</type>

<!-- For Magento Eq 2.2 -->
<type name="Magento\Framework\Mail\TransportInterface">
<plugin sortOrder="100" name="magePalCustomSmtpTransportInterface" type="MagePal\CustomSmtp\Plugin\Mail\TransportPlugin"/>
</type>
Expand Down
6 changes: 3 additions & 3 deletions view/adminhtml/web/js/validate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ define([

/** global var configForm **/
configForm.find('[id^=magepal_custom_smtp]').find(':input').serializeArray().map(function (field) {
var name = field.name.match(/groups\[custom_smtp\]?(\[groups\]\[debug\])?\[fields\]\[(.*)\]\[value]/);
var name = field.name.match(/groups\[general\]?(\[groups\]\[debug\])?\[fields\]\[(.*)\]\[value]/);

/**
* groups[custom_smtp][groups][debug][fields][email][value]
* groups[custom_smtp][fields][password][value]
* groups[general][groups][debug][fields][email][value]
* groups[general][fields][password][value]
*/

if (name && name.length === 3) {
Expand Down

0 comments on commit b808489

Please sign in to comment.