Commit 6d93a273 by lmf

增加发送邮件插件

优化产品色块和尺码为圆形
parent 0ddb698c
......@@ -1541,6 +1541,14 @@ button.action.submit.primary {
margin-left: 10%;
}
.swatch-option.color,.swatch-option.text {
border-radius: 50%;
}
.swatch-option::before {
box-shadow: 0 0 0 0px;
}
//详情页mobile修改
@media (max-width: 780px){
.product-info-stock-sku{
......@@ -1565,14 +1573,6 @@ button.action.submit.primary {
color: #999999;
}
.swatch-option.color {
border-radius: 50%;
}
.swatch-option::before {
box-shadow: 0 0 0 0px;
}
.product-info-wrapper .page-title-wrapper{
margin-top: -20px;
}
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ca9880f561f48e3f8555f10630364e2b",
"content-hash": "d0e90611d229c2dda065c2f56891ac7d",
"packages": [
{
"name": "aws/aws-crt-php",
......@@ -4436,6 +4436,139 @@
"time": "2020-12-02T21:12:59+00:00"
},
{
"name": "magepal/magento2-core",
"version": "1.1.12",
"source": {
"type": "git",
"url": "https://github.com/magepal/magento2-core.git",
"reference": "83fbffc0d540f82f55e0623719e08ecacc9c7e18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/magepal/magento2-core/zipball/83fbffc0d540f82f55e0623719e08ecacc9c7e18",
"reference": "83fbffc0d540f82f55e0623719e08ecacc9c7e18",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"magento/framework": "*"
},
"type": "magento2-module",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\Core\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"proprietary"
],
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"description": "MagePal core extension",
"homepage": "https://www.magepal.com/",
"keywords": [
"magento 2",
"magepal core extension"
],
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-core/issues/",
"source": "https://github.com/magepal/magento2-core/tree/1.1.12"
},
"time": "2021-05-29T19:47:51+00:00"
},
{
"name": "magepal/magento2-gmailsmtpapp",
"version": "2.9.0",
"source": {
"type": "git",
"url": "https://github.com/magepal/magento2-gmail-smtp-app.git",
"reference": "e6e17cf275e4cee5db603ba3aea6aae8ec8c4547"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/magepal/magento2-gmail-smtp-app/zipball/e6e17cf275e4cee5db603ba3aea6aae8ec8c4547",
"reference": "e6e17cf275e4cee5db603ba3aea6aae8ec8c4547",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"magento/framework": "103.0.*",
"magento/module-backend": "102.0.*",
"magepal/magento2-core": ">1.1.0",
"php": "~7.4.0||~8.1.0"
},
"type": "magento2-module",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\GmailSmtpApp\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"proprietary"
],
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"description": "Magento 2 SMTP Extension - Configure Magento 2 to send all transactional email using Gmail, G Suite, Amazon SES, Office360, Mailgun, SendGrid, Mandrill or any other SMTP servers",
"homepage": "https://www.magepal.com/",
"keywords": [
"Amazon SES",
"Amazon Simple Email Service",
"g suite",
"gmail smtp",
"google app",
"how to configure magento email",
"how to setup email magento2",
"magento 2",
"magento2 email",
"magento2 email setup",
"magento2 smtp",
"send email magento2"
],
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-gmail-smtp-app/issues/",
"source": "https://github.com/magepal/magento2-gmail-smtp-app/tree/2.9.0"
},
"funding": [
{
"url": "https://www.magepal.com/custom-smtp.html?utm_source=smtp&utm_medium=github%20sponsor",
"type": "custom"
}
],
"time": "2022-04-12T22:17:11+00:00"
},
{
"name": "monolog/monolog",
"version": "1.27.1",
"source": {
......
......@@ -124,12 +124,14 @@ return array(
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
'a4ecaeafb8cfb009ad0e052c90355e98' => $vendorDir . '/beberlei/assert/lib/Assert/functions.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'b5843d9aa73dbbe9d709b76cbd3ff36f' => $vendorDir . '/magepal/magento2-core/registration.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'103e25fab6e1520b3d5716d51befc8a8' => $vendorDir . '/swissup/module-breeze-integrations/registration.php',
'cbb1b03512ba520311d1592006f0c299' => $vendorDir . '/swissup/theme-frontend-breeze-blank/registration.php',
'940abd8fb01ee76a36b44f35dcf9783b' => $vendorDir . '/weew/helpers-array/src/array.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
'eda65932675b68b5aee4503e0762d64d' => $vendorDir . '/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php',
'0ba5079bc0aa31645404935d16e5e118' => $vendorDir . '/magepal/magento2-gmailsmtpapp/registration.php',
'3109cb1a231dcd04bee1f9f620d46975' => $vendorDir . '/paragonie/sodium_compat/autoload.php',
'aa75ea0761a2f40c1f3b32ad314f86c4' => $vendorDir . '/phpseclib/mcrypt_compat/lib/mcrypt.php',
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
......
......@@ -79,6 +79,8 @@ return array(
'Magento\\Composer\\' => array($vendorDir . '/magento/composer/src'),
'Magento\\' => array($baseDir . '/app/code/Magento'),
'Magento2\\' => array($vendorDir . '/magento/magento-coding-standard/Magento2'),
'MagePal\\GmailSmtpApp\\' => array($vendorDir . '/magepal/magento2-gmailsmtpapp'),
'MagePal\\Core\\' => array($vendorDir . '/magepal/magento2-core'),
'MFTF\\' => array($vendorDir . '/magento/magento2-functional-testing-framework/dev/tests/functional/tests/MFTF'),
'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'),
'League\\Flysystem\\AwsS3V3\\' => array($vendorDir . '/league/flysystem-aws-s3-v3'),
......
......@@ -125,12 +125,14 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
'a4ecaeafb8cfb009ad0e052c90355e98' => __DIR__ . '/..' . '/beberlei/assert/lib/Assert/functions.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'b5843d9aa73dbbe9d709b76cbd3ff36f' => __DIR__ . '/..' . '/magepal/magento2-core/registration.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'103e25fab6e1520b3d5716d51befc8a8' => __DIR__ . '/..' . '/swissup/module-breeze-integrations/registration.php',
'cbb1b03512ba520311d1592006f0c299' => __DIR__ . '/..' . '/swissup/theme-frontend-breeze-blank/registration.php',
'940abd8fb01ee76a36b44f35dcf9783b' => __DIR__ . '/..' . '/weew/helpers-array/src/array.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
'eda65932675b68b5aee4503e0762d64d' => __DIR__ . '/..' . '/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php',
'0ba5079bc0aa31645404935d16e5e118' => __DIR__ . '/..' . '/magepal/magento2-gmailsmtpapp/registration.php',
'3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php',
'aa75ea0761a2f40c1f3b32ad314f86c4' => __DIR__ . '/..' . '/phpseclib/mcrypt_compat/lib/mcrypt.php',
'9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php',
......@@ -237,6 +239,8 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'Magento\\Composer\\' => 17,
'Magento\\' => 8,
'Magento2\\' => 9,
'MagePal\\GmailSmtpApp\\' => 21,
'MagePal\\Core\\' => 13,
'MFTF\\' => 5,
),
'L' =>
......@@ -651,6 +655,14 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
array (
0 => __DIR__ . '/..' . '/magento/magento-coding-standard/Magento2',
),
'MagePal\\GmailSmtpApp\\' =>
array (
0 => __DIR__ . '/..' . '/magepal/magento2-gmailsmtpapp',
),
'MagePal\\Core\\' =>
array (
0 => __DIR__ . '/..' . '/magepal/magento2-core',
),
'MFTF\\' =>
array (
0 => __DIR__ . '/..' . '/magento/magento2-functional-testing-framework/dev/tests/functional/tests/MFTF',
......
......@@ -6594,6 +6594,145 @@
"install-path": "../magento/zendframework1"
},
{
"name": "magepal/magento2-core",
"version": "1.1.12",
"version_normalized": "1.1.12.0",
"source": {
"type": "git",
"url": "https://github.com/magepal/magento2-core.git",
"reference": "83fbffc0d540f82f55e0623719e08ecacc9c7e18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/magepal/magento2-core/zipball/83fbffc0d540f82f55e0623719e08ecacc9c7e18",
"reference": "83fbffc0d540f82f55e0623719e08ecacc9c7e18",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"magento/framework": "*"
},
"time": "2021-05-29T19:47:51+00:00",
"type": "magento2-module",
"installation-source": "dist",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\Core\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"proprietary"
],
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"description": "MagePal core extension",
"homepage": "https://www.magepal.com/",
"keywords": [
"magento 2",
"magepal core extension"
],
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-core/issues/",
"source": "https://github.com/magepal/magento2-core/tree/1.1.12"
},
"install-path": "../magepal/magento2-core"
},
{
"name": "magepal/magento2-gmailsmtpapp",
"version": "2.9.0",
"version_normalized": "2.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/magepal/magento2-gmail-smtp-app.git",
"reference": "e6e17cf275e4cee5db603ba3aea6aae8ec8c4547"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/magepal/magento2-gmail-smtp-app/zipball/e6e17cf275e4cee5db603ba3aea6aae8ec8c4547",
"reference": "e6e17cf275e4cee5db603ba3aea6aae8ec8c4547",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"magento/framework": "103.0.*",
"magento/module-backend": "102.0.*",
"magepal/magento2-core": ">1.1.0",
"php": "~7.4.0||~8.1.0"
},
"time": "2022-04-12T22:17:11+00:00",
"type": "magento2-module",
"installation-source": "dist",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\GmailSmtpApp\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"proprietary"
],
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"description": "Magento 2 SMTP Extension - Configure Magento 2 to send all transactional email using Gmail, G Suite, Amazon SES, Office360, Mailgun, SendGrid, Mandrill or any other SMTP servers",
"homepage": "https://www.magepal.com/",
"keywords": [
"Amazon SES",
"Amazon Simple Email Service",
"g suite",
"gmail smtp",
"google app",
"how to configure magento email",
"how to setup email magento2",
"magento 2",
"magento2 email",
"magento2 email setup",
"magento2 smtp",
"send email magento2"
],
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-gmail-smtp-app/issues/",
"source": "https://github.com/magepal/magento2-gmail-smtp-app/tree/2.9.0"
},
"funding": [
{
"url": "https://www.magepal.com/custom-smtp.html?utm_source=smtp&utm_medium=github%20sponsor",
"type": "custom"
}
],
"install-path": "../magepal/magento2-gmailsmtpapp"
},
{
"name": "monolog/monolog",
"version": "1.27.1",
"version_normalized": "1.27.1.0",
......
......@@ -3,7 +3,7 @@
'name' => 'magento/magento2ce',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '2dc23cb5b09b85980d87380e1c6330fa6c52d27f',
'reference' => 'c83cfc8de2807a1d60faa3507e08df0346299121',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......@@ -940,7 +940,7 @@
'magento/magento2ce' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '2dc23cb5b09b85980d87380e1c6330fa6c52d27f',
'reference' => 'c83cfc8de2807a1d60faa3507e08df0346299121',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......@@ -2215,6 +2215,24 @@
'aliases' => array(),
'dev_requirement' => false,
),
'magepal/magento2-core' => array(
'pretty_version' => '1.1.12',
'version' => '1.1.12.0',
'reference' => '83fbffc0d540f82f55e0623719e08ecacc9c7e18',
'type' => 'magento2-module',
'install_path' => __DIR__ . '/../magepal/magento2-core',
'aliases' => array(),
'dev_requirement' => false,
),
'magepal/magento2-gmailsmtpapp' => array(
'pretty_version' => '2.9.0',
'version' => '2.9.0.0',
'reference' => 'e6e17cf275e4cee5db603ba3aea6aae8ec8c4547',
'type' => 'magento2-module',
'install_path' => __DIR__ . '/../magepal/magento2-gmailsmtpapp',
'aliases' => array(),
'dev_requirement' => false,
),
'monolog/monolog' => array(
'pretty_version' => '1.27.1',
'version' => '1.27.1.0',
......
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Block\Adminhtml;
use Magento\Backend\Block\Template;
use MagePal\Core\Controller\Adminhtml\Version\Index;
use MagePal\Core\Helper\Data;
class Badge extends Template
{
const SEARCH_URL = 'https://www.magepal.com/catalogsearch/result/';
/**
* @var Data
*/
private $dataHelper;
/**
* Badge constructor.
* @param Template\Context $context
* @param Data $dataHelper
* @param array $data
*/
public function __construct(
Template\Context $context,
Data $dataHelper,
array $data = []
) {
parent::__construct($context, $data);
$this->dataHelper = $dataHelper;
}
/**
* @return bool
*/
public function getNotificationOption()
{
return $this->dataHelper->getBadgeNotificationValue();
}
/**
* @return string
*/
public function getNotificationUrl()
{
return $this->getUrl('magepal/version/index');
}
/**
* @return bool
*/
public function isAuthorized()
{
return $this->_authorization->isAllowed(Index::ADMIN_RESOURCE);
}
/**
* @return string
*/
public function getSearchUrl()
{
return self::SEARCH_URL . '?utm_source=search&utm_medium=admin&utm_campaign=core';
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Block\Adminhtml\System\Config\Composer;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use MagePal\Core\Model\Module;
class Version extends Field
{
/**
* @var Module
*/
private $module;
/**
* @param Context $context
* @param Module $module
* @param array $data
*/
public function __construct(
Context $context,
Module $module,
array $data = []
) {
parent::__construct($context, $data);
$this->module = $module;
}
/**
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
// Remove scope label
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$isElementIdModuleName = (strpos($element->getOriginalData('id'), 'MagePal_') === 0);
$moduleName = $isElementIdModuleName ? $element->getOriginalData('id') : $this->getModuleName();
return 'v' . $this->module->getInstalledVersion($moduleName);
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Block\Adminhtml\System\Config\Field;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use MagePal\Core\Model\Module;
class Extensions extends Field
{
/**
* @var string
*/
protected $_template = 'MagePal_Core::system/config/field/extensions.phtml';
/**
* @var Module
*/
private $module;
public function __construct(
Context $context,
Module $module,
array $data = []
) {
parent::__construct($context, $data);
$this->module = $module;
}
/**
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
return $this->toHtml();
}
/**
* @return int
*/
public function getUpdateCount()
{
return $this->module->getUpdateCount();
}
/**
* @return array
*/
public function getExtensionList()
{
return $this->module->getOutDatedExtension();
}
/**
* @return array
*/
public function getRelatedProduct()
{
$result = [];
$installedExtensions = $this->module->getMyExtensionList();
foreach ($this->module->getProductFeed() as $key => $item) {
if (isset($item['upsell']) && $item['upsell'] == 1 && !array_key_exists($key, $installedExtensions)) {
$result[$key] = $item;
}
}
return $result;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Block\Adminhtml\System\Config\Field;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
class Search extends Field
{
/**
* @var string
*/
protected $_template = 'MagePal_Core::system/config/field/search.phtml';
/**
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
return $this->toHtml();
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Controller\Adminhtml\Version;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\Controller\ResultInterface;
use MagePal\Core\Model\Module;
class Index extends Action
{
const ADMIN_RESOURCE = 'MagePal_Core::config';
/**
* @var JsonFactory
*/
private $resultJsonFactory;
/**
* @var Module
*/
private $module;
/**
* Index constructor.
* @param Context $context
* @param JsonFactory $resultJsonFactory
* @param Module $module
*/
public function __construct(
Context $context,
JsonFactory $resultJsonFactory,
Module $module
) {
parent::__construct($context);
$this->resultJsonFactory = $resultJsonFactory;
$this->module = $module;
}
/**
* Index action
*
* @return ResultInterface
*/
public function execute()
{
$data = [
'success' => 1,
'count' => $this->module->getCachedUpdateCount()
];
$result = $this->resultJsonFactory->create();
$result->setHeader('Cache-Control', 'max-age=302400', true);
$result->setHeader('Pragma', 'cache', true);
$result->setData($data);
return $result;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;
class Data extends AbstractHelper
{
const XML_PATH_ACTIVE = 'magepal_core/general/badge_notification';
const NOTIFICATION_DISABLED = 0;
const NOTIFICATION_ENABLED = 1;
const NOTIFICATION_WITHIN_TAB = 2;
/**
* If enabled
*
* @param null $scopeCode
* @return bool
*/
public function getBadgeNotificationValue($scopeCode = null)
{
return (int) $this->scopeConfig->getValue(
self::XML_PATH_ACTIVE,
ScopeInterface::SCOPE_STORE,
$scopeCode
);
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\Core\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
use MagePal\Core\Helper\Data;
class BadgeNotification implements ArrayInterface
{
/**
* @return array
*/
public function toOptionArray()
{
return [
['value' => Data::NOTIFICATION_ENABLED, 'label' => 'Yes'],
['value' => Data::NOTIFICATION_WITHIN_TAB, 'label' => 'When Tab Open'],
['value' => Data::NOTIFICATION_DISABLED, 'label' => __('No')]
];
}
}
<a href="http://www.magepal.com" title="Magento Extensions" ><img src="https://image.ibb.co/dHBkYH/Magepal_logo.png" width="100" align="right" title="Magento Custom Modules" /></a>
# MagePal Core Extension:
![magepal-core](https://user-images.githubusercontent.com/1415141/87557253-a9cdac80-c685-11ea-9f22-d2fa44b184a9.png)
---
- [Custom SMTP](https://www.magepal.com/magento2/extensions/custom-smtp.html)
- [Catalog Hover Image for Magento](https://www.magepal.com/magento2/extensions/catalog-hover-image-for-magento.html)
- [Enhanced Success Page for Magento 2](https://www.magepal.com/magento2/extensions/enhanced-success-page.html)
- [Enhanced Transactional Emails for Magento 2](https://www.magepal.com/magento2/extensions/enhanced-transactional-emails.html)
- [Google Tag Manager](https://www.magepal.com/magento2/extensions/google-tag-manager.html)
- [Enhanced E-commerce](https://www.magepal.com/magento2/extensions/enhanced-ecommerce-for-google-tag-manager.html)
- [Reindex](https://www.magepal.com/magento2/extensions/reindex.html)
- [Custom Shipping Method](https://www.magepal.com/magento2/extensions/custom-shipping-rates-for-magento-2.html)
- [Preview Order Confirmation](https://www.magepal.com/magento2/extensions/preview-order-confirmation-page-for-magento-2.html)
- [Guest to Customer](https://www.magepal.com/magento2/extensions/guest-to-customer.html)
- [Admin Form Fields Manager](https://www.magepal.com/magento2/extensions/admin-form-fields-manager-for-magento-2.html)
- [Customer Dashboard Links Manager](https://www.magepal.com/magento2/extensions/customer-dashboard-links-manager-for-magento-2.html)
- [Lazy Loader](https://www.magepal.com/magento2/extensions/lazy-load.html)
- [Order Confirmation Page Miscellaneous Scripts](https://www.magepal.com/magento2/extensions/order-confirmation-miscellaneous-scripts-for-magento-2.html)
- [HTML Minifier for Magento2](https://www.magepal.com/magento2/extensions/html-minifier.html)
© MagePal LLC. | [www.magepal.com](https://www.magepal.com)
{
"name": "magepal/magento2-core",
"description": "MagePal core extension",
"keywords": [
"magento 2",
"magepal core extension"
],
"license": [
"proprietary"
],
"homepage": "https://www.magepal.com/",
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-core/issues/"
},
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"require": {
"magento/framework": "*"
},
"type": "magento2-module",
"version": "1.1.12",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\Core\\": ""
}
}
}
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="MagePal_Core::config" title="MagePal Notification"/>
</resource>
</resources>
</acl>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="magepal" frontName="magepal">
<module name="MagePal_Core" before="Magento_Backend" />
</route>
</router>
</config>
<?xml version="1.0"?>
<!--
/*
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="magepal" translate="label" sortOrder="400" class="admin__page-magepal-tab">
<label>MagePal</label>
</tab>
<section id="magepal_core" translate="label" type="text" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Notifications & Updates]]></label>
<tab>magepal</tab>
<resource>MagePal_Core::config</resource>
<group id="notification" type="text" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="0" translate="label">
<label>Search</label>
<attribute type="expanded">1</attribute>
<frontend_model>MagePal\Core\Block\Adminhtml\System\Config\Field\Search</frontend_model>
</group>
<group id="updates" type="text" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
<label>Updates</label>
<attribute type="expanded">1</attribute>
<frontend_model>MagePal\Core\Block\Adminhtml\System\Config\Field\Extensions</frontend_model>
</group>
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="20" translate="label">
<label>Setting</label>
<field id="badge_notification" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Badge Notification</label>
<source_model>MagePal\Core\Model\Config\Source\BadgeNotification</source_model>
<comment><![CDATA[When Tab Open - Badge update count only shows when MagePal tab is expanded, in the "Notifications & Updates" section.]]></comment>
</field>
</group>
</section>
</system>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<magepal_core>
<general>
<badge_notification>1</badge_notification>
</general>
</magepal_core>
</default>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MagePal_Core" setup_version="1.0.0" />
</config>
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'MagePal_Core',
__DIR__
);
<?xml version="1.0"?>
<!--
/*
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="MagePal_Core::css/config.css" />
</head>
<body>
<referenceContainer name="content">
<block class="MagePal\Core\Block\Adminhtml\Badge" name="magepal_email_edit"
template="MagePal_Core::badge.phtml"/>
</referenceContainer>
</body>
</page>
var config = {
map: {
'*': {
magePalCoreNotificationIcon: 'MagePal_Core/js/notification-icon'
}
}
};
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
/** @var $block \MagePal\Core\Block\Adminhtml\Badge */
?>
<?php if ($block->isAuthorized()) : ?>
<script type="text/x-magento-init">
{
"*": {
"magePalCoreNotificationIcon": {
"url":"<?= $block->escapeUrl($block->getNotificationUrl()) ?>",
"searchUrl":"<?= $block->escapeUrl($block->getSearchUrl()) ?>",
"notificationOption": "<?= $block->getNotificationOption() ?>"
}
}
}
</script>
<?php endif; ?>
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
/** @var $block MagePal\Core\Block\Adminhtml\System\Config\Field\Extensions */
?>
<div id="magepal-extension-list">
<?php if ($block->getUpdateCount()): ?>
<div class="entry-edit-head">
<?= __('Get the latest updates') ?>
</div>
<div class="cards">
<?php foreach ($block->getExtensionList() as $item): ?>
<?php if ($item['has_update']): ?>
<div class="card">
<div class="headerline">
<?= $block->escapeHtml($item['name'] ?? '') ?>
</div>
<div class="wrapper">
<div class="text-version update">
<span><?= $block->escapeHtml($item['install_version'] ?? '') ?></span>
<span>&#8594;</span>
<span><?= $block->escapeHtml($item['latest_version'] ?? '') ?></span>
</div>
<?php if (isset($item['url'])): ?>
<div class="info">
<a href="<?= $block->escapeUrl($item['url']) ?>" target="_blank">Learn More</a>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if (count($block->getExtensionList()) > $block->getUpdateCount()): ?>
<div class="entry-edit-head">
<?= __('Up-to-Date Extensions') ?>
</div>
<div class="cards">
<?php foreach ($block->getExtensionList() as $item): ?>
<?php if (!$item['has_update']): ?>
<div class="card">
<div class="headerline"><?= $block->escapeHtml($item['name'] ?? '') ?></div>
<div class="wrapper">
<div class="text-version">
<?= $block->escapeHtml($item['install_version'] ?? '') ?>
</div>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach ($block->getRelatedProduct() as $item): ?>
<div class="card">
<div class="headerline"><?= $block->escapeHtml($item['name'] ?? '') ?></div>
<div class="wrapper">
<div class="latest-version">
<?= __('Not Installed') ?>
</div>
<?php if (isset($item['url'])): ?>
<div class="info">
<a href="<?= $block->escapeUrl($item['url']) ?>" target="_blank">Get Now!</a>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
?>
<div class="magepal-extension-search">
<div class="search">
<div id="cover">
<div class="tb">
<div class="td">
<input type="text" name="search_query" class="search-input"
placeholder="Search MagePal Extension Marketplace for..." />
</div>
<div class="td" id="s-cover">
<button type="button">
<div id="s-circle"></div>
<span></span>
</button>
</div>
</div>
</div>
</div>
</div>
.config-nav-block {
.mp-logo {
background: url(../images/magepal-logo.png) no-repeat;
vertical-align: middle;
background-size: cover;
display: inline-block;
height: 30px;
line-height: 25px;
margin-top: -1.2em;
min-width: 30px;
position: absolute;
top: 50%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
&.admin__page-magepal-tab {
strong {
display: flex;
align-items: center;
&:before {
/*background: url(../images/magepal-logo.png) no-repeat;*/
width: 20px;
height: 16px;
background-size: cover;
content: '';
display: inline-block;
margin-right: 18px;
vertical-align: middle;
}
}
@media (min-width: 1245px) {
&._hide li.item {
.notifications-counter {
display: none;
}
}
&._show strong {
.notifications-counter {
display: none;
}
}
}
@media (max-width: 1245px) {
li.item {
.notifications-counter {
display: none;
}
}
}
.notifications-counter {
background-color: #eb5202;
border-radius: 1em;
color: #ffffff;
display: inline-block;
font-size: 1.2rem;
font-weight: 700;
height: 25px;
left: 100%;
line-height: 25px;
margin-left: -5.7em;
margin-top: -1.1em;
min-width: 25px;
position: absolute;
text-align: center;
top: 50%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
}
}
#magepal-extension-list {
.entry-edit-head {
font-size: 2.0rem;
padding: 1.8rem 1.5rem;
text-transform: uppercase;
background-color: #f8f8f8;
border-bottom: 1px solid #e3e3e3;
border-top: 1px solid #e3e3e3;
margin-bottom: 13px;
}
.headerline {
color: black;
font-weight: 600;
text-align: center;
height: 45px;
box-shadow: 0 11px 17px -17px #000000;
}
.text-version {
margin-top: 12px;
text-align: center;
color: green;
}
.latest-version {
margin-top: 12px;
text-align: center;
color: red;
}
.update {
color: red;
}
.card {
background-color: #f8f8f8;
border: #41362f;
color: white;
padding: 1rem;
height: 10rem;
border-radius: 10px;
box-shadow: 0 8px 5px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
.cards {
margin-top: 10px;
margin-bottom: 30px;
display: grid;
grid-gap: 1rem;
}
/* Screen larger than 600px? 2 column */
@media (min-width: 400px) {
.cards { grid-template-columns: repeat(2, 1fr); }
}
/* Screen larger than 900px? 3 columns */
@media (min-width: 700px) {
.cards { grid-template-columns: repeat(3, 1fr); }
}
/* Screen larger than 900px? 3 columns */
@media (min-width: 1200px) {
.cards { grid-template-columns: repeat(4, 1fr); }
}
/* Screen larger than 900px? 3 columns */
@media (min-width: 1300px) {
.cards { grid-template-columns: repeat(5, 1fr); }
}
/* Screen larger than 900px? 3 columns */
@media (min-width: 1600px) {
.cards { grid-template-columns: repeat(6, 1fr); }
}
.info {
text-align: center;
color: black;
padding-top: 3px;
a {
color: black;
}
}
}
.magepal-extension-search {
background-color: #514943;
margin-bottom: 20px;
.tb
{
display: table;
width: 100%;
}
.td
{
display: table-cell;
vertical-align: middle;
}
input, button
{
color: #fff;
padding: 0;
margin: 0;
border: 0;
background-color: transparent;
}
#cover
{
padding: 35px;
background-color: #1C96BC;
border-radius: 20px;
box-shadow: 0 10px 40px #a9afb0, 0 0 0 20px #ffffffeb;
transform: scale(0.6);
}
input[type="text"]
{
width: 100%;
height: 65px;
font-size: 20px;
line-height: 1;
@media (min-width: 1130px) {
font-size: 25px;
}
@media (min-width: 1325px) {
font-size: 32px;
}
}
input[type="text"]::placeholder
{
color: black;
}
input[type="text"]::-webkit-input-placeholder {
color: black;
}
input[type="text"]:-moz-placeholder { /* Firefox 18- */
color: black;
}
input[type="text"]::-moz-placeholder { /* Firefox 19+ */
color: black;
}
input[type="text"]:-ms-input-placeholder {
color: black;
}
#s-cover
{
width: 1px;
padding-left: 35px;
}
button
{
position: relative;
display: block;
width: 84px;
height: 96px;
cursor: pointer;
}
#s-circle
{
position: relative;
top: -8px;
left: 0;
width: 43px;
height: 43px;
margin-top: 0;
border: 15px solid #fff;
background-color: transparent;
border-radius: 50%;
transition: 0.5s ease all;
}
button span
{
position: absolute;
top: 68px;
left: 43px;
display: block;
width: 45px;
height: 15px;
background-color: transparent;
border-radius: 10px;
transform: rotateZ(52deg);
transition: 0.5s ease all;
}
button span:before, button span:after
{
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 45px;
height: 15px;
background-color: #fff;
border-radius: 10px;
transform: rotateZ(0);
transition: 0.5s ease all;
}
#s-cover:hover #s-circle
{
top: -1px;
width: 67px;
height: 15px;
border-width: 0;
background-color: #fff;
border-radius: 20px;
}
#s-cover:hover span
{
top: 50%;
left: 56px;
width: 25px;
margin-top: -9px;
transform: rotateZ(0);
}
#s-cover:hover button span:before
{
bottom: 11px;
transform: rotateZ(52deg);
}
#s-cover:hover button span:after
{
bottom: -11px;
transform: rotateZ(-52deg);
}
#s-cover:hover button span:before, #s-cover:hover button span:after
{
right: -6px;
width: 40px;
background-color: #fff;
}
#ytd-url {
display: block;
position: fixed;
right: 0;
bottom: 0;
padding: 10px 14px;
margin: 20px;
color: #fff;
font-size: 14px;
text-decoration: none;
background-color: #ff7575;
border-radius: 4px;
box-shadow: 0 10px 20px -5px rgba(255, 117, 117, 0.86);
z-index: 125;
}
}
.section-config.active {
#magepal-info, #magepal-info-dl, #magepal-info-ee, .magepal-info{
padding-bottom: 5px;
a {
font-weight: bold;
border-left: 2px solid #e3e3e3;
padding-left:10px;
padding-right:10px;
color: #ef7e1e;
&:first-child {
padding-left: 5px;
border-left: none;
}
}
}
#upgrade-to-enhanced-ecommerce,
#upgrade-to-datalayer,
#upgrade-to-google-analytics4,
.magepal-extension-promo
{
padding: 7px 10px;
border: 1px solid #e3e3e3;
background: #f8f8f8;
margin-bottom: 5px;
}
#system_gmailsmtpapp-head,
#googletagmanager_about-head,
#googletagmanager_enhanced_ecommerce-head,
#googletagmanager_datalayer-head,
#enhanced_transactional_emails_general-head,
#magepal_checkout_preview_success_page-head
{
padding-bottom: 0;
}
a[id$="about_magepal-head"] {
padding-bottom: 0;
}
#row_googletagmanager_gdpr_note label span{
display:none;
}
.magepal-hr {
border-top: 1px solid #e3e3e3
}
}
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
define([
'jquery'
], function ($) {
'use strict';
var $searchField = $('.magepal-extension-search .search-input');
var $searchButton = $('.magepal-extension-search button');
var $element = $('div.config-nav-block.admin__page-magepal-tab strong');
var html = '<span class="mp-logo"></span>';
$element.before(html);
var showBadge = function (config) {
$.ajax({
url: config.url,
type: 'get',
dataType: 'json',
error: function (){}
}).done(function (response) {
if (typeof response === 'object' && response.hasOwnProperty('count') && response.count > 0) {
var html = '<span class="notifications-counter">' + response.count + '</span>';
if (config.notificationOption !== 1) {
$element.append(html);
}
$element.parent().parent().find('ul.items li.item:first').append(html)
}
});
};
return function (config) {
if (config.notificationOption !== 0) {
showBadge(config);
}
var openWindow = function ($element) {
if ($($element).val().length > 2) {
var newTab = window.open();
newTab.location.href = config.searchUrl + '&q=' + encodeURI($element.val());
}
};
$searchField.keypress(function (event) {
if (event.keyCode === 13 || event.which === 13) {
openWindow($(this));
event.preventDefault();
}
});
$searchButton.on('click', function (event) {
event.preventDefault();
openWindow($searchField)
});
}
});
*.phtml linguist-language=PHP
*.html linguist-language=PHP
# These are supported funding model platforms
#github: [srenon]
custom: ['https://www.magepal.com/custom-smtp.html?utm_source=smtp&utm_medium=github%20sponsor']
<!--- Before adding a new issue, please check all closed and existing issues to make sure this is not a duplicate -->
<!--- https://www.magepal.com/magento2/extensions/custom-smtp.html for fast Premium Support -->
#### Magento version #:
#### Edition (EE, CE, OS, etc):
#### Expected behavior:
#### Actual behavior:
#### Steps to reproduce:
#### Preconditions
<!--- Provide a more detailed information of environment you use -->
<!--- Magento version, tag, HEAD, etc., PHP & MySQL version, etc.. -->
<!---
PLEASE NOTE:
We receive multiple emails & support tickets almost daily asking for help.
In most cases these issues have nothing to do with our extension and mostly
caused by lack of basic Magento knowledge or not following installation instructions.
At MagePal, our goal is to develop a wide variety of both free and paid extension
and due to our limited resources, our main focus are fixing reported bugs and developing
other great extensions.
Because of this, we cannot provide free support for our free extensions.
However, we do offer very affordable support options and/or training.
For more information visit www.magepal.com or email us at support@magepal.com.
-->
name: PHPCS
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: PHPCS
run: docker run --rm -v $PWD:/code:ro domw/phpcs phpcs --colors --standard=Magento2 --report=full,summary,gitblame --extensions=php,phtml ./
- name: compatibility
run: docker run --rm -v $PWD:/code:ro domw/phpcompatibility phpcs --standard=PHPCompatibility --runtime-set testVersion 5.6-7.4 --colors --warning-severity=0 --report=full,summary --extensions=php,phtml ./
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Block\Adminhtml\System\Config\Form\Composer;
use Exception;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\Component\ComponentRegistrarInterface;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Filesystem\Directory\ReadFactory;
class Version extends Field
{
/**
* @var DeploymentConfig
*/
protected $deploymentConfig;
/**
* @var ComponentRegistrarInterface
*/
protected $componentRegistrar;
/**
* @var ReadFactory
*/
protected $readFactory;
/**
* @param Context $context
* @param DeploymentConfig $deploymentConfig
* @param ComponentRegistrarInterface $componentRegistrar
* @param ReadFactory $readFactory
* @param array $data
*/
public function __construct(
Context $context,
DeploymentConfig $deploymentConfig,
ComponentRegistrarInterface $componentRegistrar,
ReadFactory $readFactory,
array $data = []
) {
$this->deploymentConfig = $deploymentConfig;
$this->componentRegistrar = $componentRegistrar;
$this->readFactory = $readFactory;
parent::__construct($context, $data);
}
/**
* Render button
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
// Remove scope label
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _getElementHtml(AbstractElement $element)
{
return 'v' . $this->getVersion();
}
/**
* Get Module version number
*
* @return string
*/
public function getVersion()
{
return $this->getComposerVersion($this->getModuleName());
}
/**
* Get module composer version
*
* @param $moduleName
* @return string
*/
public function getComposerVersion($moduleName)
{
$path = $this->componentRegistrar->getPath(
ComponentRegistrar::MODULE,
$moduleName
);
try {
$directoryRead = $this->readFactory->create($path);
$composerJsonData = $directoryRead->readFile('composer.json');
if ($composerJsonData) {
$data = json_decode($composerJsonData);
return !empty($data->version) ? $data->version : __('Unknown');
}
} catch (Exception $e) {
return 'Unknown';
}
return 'Unknown';
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Block\Adminhtml\System\Config\Form\Field;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
class Link extends Field
{
/**
* Render button
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
// Remove scope label
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _getElementHtml(AbstractElement $element)
{
return sprintf(
'<a href ="%s#system_gmailsmtpapp-link">%s</a>',
rtrim($this->_urlBuilder->getUrl('adminhtml/system_config/edit/section/system'), '/'),
__('Stores > Configuration > Advanced > System > SMTP Configuration and Settings')
);
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Block\Adminhtml\System\Config\Form\Module;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Module\ModuleListInterface;
class Version extends Field
{
/**
* @var ModuleListInterface
*/
protected $_moduleList;
/**
* @param Context $context
* @param ModuleListInterface $moduleList
* @param array $data
*/
public function __construct(
Context $context,
ModuleListInterface $moduleList,
array $data = []
) {
parent::__construct($context, $data);
$this->_moduleList = $moduleList;
}
/**
* Render button
*
* @param AbstractElement $element
* @return string
* @throws LocalizedException
*/
public function render(AbstractElement $element)
{
// Remove scope label
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _getElementHtml(AbstractElement $element)
{
return 'v' . $this->getVersion();
}
/**
* Get Module version number
*
* @return string
*/
public function getVersion()
{
$moduleInfo = $this->_moduleList->getOne($this->getModuleName());
return $moduleInfo['setup_version'];
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Block\Adminhtml\System\Config;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Button;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Exception\LocalizedException;
/**
* "Reset to Defaults" button renderer
*
*/
class ValidateConfigButton extends Field
{
/** @var UrlInterface */
protected $_urlBuilder;
/**
* @param Context $context
* @param array $data
*/
public function __construct(
Context $context,
array $data = []
) {
$this->_urlBuilder = $context->getUrlBuilder();
parent::__construct($context, $data);
}
/**
* Set template
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setTemplate('MagePal_GmailSmtpApp::system/config/validateConfigButton.phtml');
}
/**
* Generate button html
*
* @return string
* @throws LocalizedException
*/
public function getButtonHtml()
{
$button = $this->getLayout()->createBlock(
Button::class
)->setData(
[
'id' => 'gmailsmtpapp_debug_result_button',
'label' => __('Send Test Email')
]
);
return $button->toHtml();
}
public function getAdminUrl()
{
return $this->_urlBuilder->getUrl(
'magepalsmtp/validateconfig',
['store' => $this->_request->getParam('store')]
);
}
/**
* Render button
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
// Remove scope label
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _getElementHtml(AbstractElement $element)
{
return $this->_toHtml();
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Controller\Adminhtml\Validateconfig;
use Magento\Backend\App\Action;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;
class Index extends Action
{
/**
* Authorization level of a basic admin session
*/
const ADMIN_RESOURCE = 'MagePal_GmailSmtpApp::magepal_gmailsmtpapp';
/**
* Index action
*
* @return ResultInterface
*/
public function execute()
{
return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;
class Data extends AbstractHelper
{
/**
* @var null $storeId
*/
protected $storeId = null;
/** @var bool $testMode */
protected $testMode = false;
/** @var array $testConfig */
protected $testConfig = [];
/**
* @param null $key
* @return array|mixed|string
*/
public function getTestConfig($key = null)
{
if ($key === null) {
return $this->testConfig;
} elseif (!array_key_exists($key, $this->testConfig)) {
return '';
} else {
return $this->testConfig[$key];
}
}
/**
* @param null $fields
* @return $this
*/
public function setTestConfig($fields)
{
$this->testConfig = (array) $fields;
return $this;
}
/**
* @param null $store_id
* @return bool
*/
public function isActive($store_id = null)
{
if ($store_id == null && $this->getStoreId() > 0) {
$store_id = $this->getStoreId();
}
return $this->scopeConfig->isSetFlag(
'system/gmailsmtpapp/active',
ScopeInterface::SCOPE_STORE,
$store_id
);
}
/**
* Get local client name
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigName($store_id = null)
{
return $this->getConfigValue('name', $store_id);
}
/**
* Get system config password
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigPassword($store_id = null)
{
return $this->getConfigValue('password', $store_id);
}
/**
* Get system config username
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigUsername($store_id = null)
{
return $this->getConfigValue('username', $store_id);
}
/**
* Get system config auth
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigAuth($store_id = null)
{
return $this->getConfigValue('auth', $store_id);
}
/**
* Get system config ssl
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigSsl($store_id = null)
{
return $this->getConfigValue('ssl', $store_id);
}
/**
* Get system config host
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigSmtpHost($store_id = null)
{
return $this->getConfigValue('smtphost', $store_id);
}
/**
* Get system config port
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigSmtpPort($store_id = null)
{
return $this->getConfigValue('smtpport', $store_id);
}
/**
* Get system config reply to
*
* @param ScopeInterface::SCOPE_STORE $store
* @return bool
*/
public function getConfigSetReplyTo($store_id = null)
{
return $this->scopeConfig->isSetFlag(
'system/gmailsmtpapp/set_reply_to',
ScopeInterface::SCOPE_STORE,
$store_id
);
}
/**
* Get system config set return path
*
* @param ScopeInterface::SCOPE_STORE $store
* @return int
*/
public function getConfigSetReturnPath($store_id = null)
{
return (int) $this->getConfigValue('set_return_path', $store_id);
}
/**
* Get system config return path email
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigReturnPathEmail($store_id = null)
{
return $this->getConfigValue('return_path_email', $store_id);
}
/**
* Get system config from
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigSetFrom($store_id = null)
{
return (int) $this->getConfigValue('set_from', $store_id);
}
/**
* Get system config from
*
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigCustomFromEmail($store_id = null)
{
return $this->getConfigValue('custom_from_email', $store_id);
}
/**
* Get system config
*
* @param String path
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigValue($path, $store_id = null)
{
//send test mail
if ($this->isTestMode()) {
return $this->getTestConfig($path);
}
//return value from core config
return $this->getScopeConfigValue(
"system/gmailsmtpapp/{$path}",
$store_id
);
}
/**
* @param String path
* @param ScopeInterface::SCOPE_STORE $store
* @return mixed
*/
public function getScopeConfigValue($path, $store_id = null)
{
//use global store id
if ($store_id === null && $this->getStoreId() > 0) {
$store_id = $this->getStoreId();
}
//return value from core config
return $this->scopeConfig->getValue(
$path,
ScopeInterface::SCOPE_STORE,
$store_id
);
}
/**
* @return int/null
*/
public function getStoreId()
{
return $this->storeId;
}
/**
* @param int/null $storeId
*/
public function setStoreId($storeId = null)
{
$this->storeId = $storeId;
}
/**
* @return bool
*/
public function isTestMode()
{
return (bool) $this->testMode;
}
/**
* @param bool $testMode
* @return Data
*/
public function setTestMode($testMode)
{
$this->testMode = (bool) $testMode;
return $this;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\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\GmailSmtpApp\Helper\Data;
use MagePal\GmailSmtpApp\Model\Store;
/**
* Class Smtp
* For Magento >= 2.2.8
*/
class Smtp
{
/**
* @var Data
*/
protected $dataHelper;
/**
* @var Store
*/
protected $storeModel;
/**
* @param Data $dataHelper
* @param Store $storeModel
*/
public function __construct(
Data $dataHelper,
Store $storeModel
) {
$this->dataHelper = $dataHelper;
$this->storeModel = $storeModel;
}
/**
* @param Data $dataHelper
* @return Smtp
*/
public function setDataHelper(Data $dataHelper)
{
$this->dataHelper = $dataHelper;
return $this;
}
/**
* @param Store $storeModel
* @return Smtp
*/
public function setStoreModel(Store $storeModel)
{
$this->storeModel = $storeModel;
return $this;
}
/**
* @param $message
* @return Message
*/
protected function convertMessage($message)
{
/**
* Issues in Zend Framework 2
* https://github.com/zendframework/zendframework/issues/2492
* https://github.com/zendframework/zendframework/issues/2492
*/
$encoding = 'utf-8';
try {
$reflect = new \ReflectionClass($message);
$zendMessageObject = $reflect->getProperty('zendMessage');
$zendMessageObject->setAccessible(true);
/** @var Message $zendMessage */
$zendMessage = $zendMessageObject->getValue($message);
if ($message instanceof EmailMessageInterface) {
$encoding = $message->getEncoding();
} else {
$encoding = $zendMessage->getEncoding();
}
if (!$zendMessage instanceof Message) {
throw new MailException('Not instance of Message');
}
} catch (Exception $e) {
$zendMessage = Message::fromString($message->getRawMessage());
}
$zendMessage->setEncoding($encoding);
return $zendMessage;
}
/**
* @param MessageInterface | EmailMessageInterface $message
* @throws MailException
*/
public function sendSmtpMessage(
$message
) {
$dataHelper = $this->dataHelper;
$dataHelper->setStoreId($this->storeModel->getStoreId());
/** @var Message $message */
$message = $this->convertMessage($message);
$this->setReplyToPath($message);
$this->setSender($message);
foreach ($message->getHeaders()->toArray() as $headerKey => $headerValue) {
$mailHeader = $message->getHeaders()->get($headerKey);
if ($mailHeader instanceof HeaderInterface) {
$this->updateMailHeader($mailHeader);
} elseif ($mailHeader instanceof \ArrayIterator) {
foreach ($mailHeader as $header) {
$this->updateMailHeader($header);
}
}
}
try {
$transport = new SmtpTransport();
$transport->setOptions($this->getSmtpOptions());
$transport->send($message);
} catch (Exception $e) {
throw new MailException(
new Phrase($e->getMessage()),
$e
);
}
}
/**
*
* @param Message $message
*/
protected function setSender($message)
{
$dataHelper = $this->dataHelper;
//Set from address
switch ($dataHelper->getConfigSetFrom()) {
case 1:
$setFromEmail = $message->getFrom()->count() ? $message->getFrom() : $this->getFromEmailAddress();
break;
case 2:
$setFromEmail = $dataHelper->getConfigCustomFromEmail();
break;
default:
$setFromEmail = null;
break;
}
if ($setFromEmail !== null && $dataHelper->getConfigSetFrom()) {
if (is_string($setFromEmail)) {
$name = $this->getFromName();
$message->setFrom(trim($setFromEmail), $name);
$message->setSender(trim($setFromEmail), $name);
} elseif ($setFromEmail instanceof AddressList) {
foreach ($setFromEmail as $address) {
$message->setFrom($address);
$message->setSender($address);
}
}
}
if (!$message->getFrom()->count()) {
$result = $this->storeModel->getFrom();
$message->setFrom($result['email'], $result['name']);
}
}
/**
* @param Message $message
*/
protected function setReplyToPath($message)
{
$dataHelper = $this->dataHelper;
//Set reply-to path
switch ($dataHelper->getConfigSetReturnPath()) {
case 1:
$returnPathEmail = $message->getFrom()->count() ? $message->getFrom() : $this->getFromEmailAddress();
break;
case 2:
$returnPathEmail = $dataHelper->getConfigReturnPathEmail();
break;
default:
$returnPathEmail = null;
break;
}
if (!$message->getReplyTo()->count() && $dataHelper->getConfigSetReplyTo()) {
if (is_string($returnPathEmail)) {
$name = $this->getFromName();
$message->setReplyTo(trim($returnPathEmail), $name);
} elseif ($returnPathEmail instanceof AddressList) {
foreach ($returnPathEmail as $address) {
$message->setReplyTo($address);
}
}
}
}
/**
* @return SmtpOptions
*/
protected function getSmtpOptions()
{
$dataHelper = $this->dataHelper;
//set config
$options = new SmtpOptions([
'name' => $dataHelper->getConfigName(),
'host' => $dataHelper->getConfigSmtpHost(),
'port' => $dataHelper->getConfigSmtpPort(),
]);
$connectionConfig = [];
$auth = strtolower($dataHelper->getConfigAuth());
if ($auth != 'none') {
$options->setConnectionClass($auth);
$connectionConfig = [
'username' => $dataHelper->getConfigUsername(),
'password' => $dataHelper->getConfigPassword()
];
}
$ssl = $dataHelper->getConfigSsl();
if ($ssl != 'none') {
$connectionConfig['ssl'] = $ssl;
}
if (!empty($connectionConfig)) {
$options->setConnectionConfig($connectionConfig);
}
return $options;
}
/**
* @param $header
*/
public function updateMailHeader($header)
{
if ($header instanceof HeaderInterface) {
if (Mime::isPrintable($header->getFieldValue())) {
$header->setEncoding('ASCII');
} else {
$header->setEncoding('utf-8');
}
}
}
/**
* @return string
*/
public function getFromEmailAddress()
{
$result = $this->storeModel->getFrom();
return isset($result['email']) ? $result['email'] : '';
}
/**
* @return string
*/
public function getFromName()
{
$result = $this->storeModel->getFrom();
return isset($result['name']) ? $result['name'] : '';
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
class Authtype implements ArrayInterface
{
/**
* @return array
*/
public function toOptionArray()
{
return [
['value' => 'none', 'label' => __('None')],
['value' => 'ssl', 'label' => 'SSL'],
['value' => 'tls', 'label' => 'TLS']
];
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Model;
use Magento\Framework\App\Area;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Mail\Template\Factory;
use Magento\Framework\Mail\Template\TransportBuilder;
use Magento\Framework\Mail\TemplateInterface;
use Magento\Framework\Translate\Inline\StateInterface;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
use MagePal\GmailSmtpApp\Helper\Data;
class Email
{
const XML_PATH_EMAIL_TEMPLATE_ZEND_TEST = 'system/gmailsmtpapp/zend_email_template';
const XML_PATH_EMAIL_TEMPLATE_MAGENTO_TEST = 'system/gmailsmtpapp/magento_email_template';
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;
/**
* @var Data
*/
protected $dataHelper;
/**
* @var Factory
*/
protected $templateFactory;
/**
* Store manager
*
* @var StoreManagerInterface
*/
protected $storeManager;
/**
* @var array
*/
private $templateVars = [];
/**
* @var array
*/
private $templateOptions = [];
/**
* Template Model
*
* @var string
*/
private $templateModel;
/**
* @var StateInterface
*/
protected $inlineTranslation;
/**
* @var TransportBuilder
*/
protected $_transportBuilder;
/**
* @param Data $dataHelper
* @param Factory $templateFactory
* @param ScopeConfigInterface $scopeConfig
* @param StoreManagerInterface $storeManager
* @param StateInterface $inlineTranslation
* @param TransportBuilder $transportBuilder
*/
public function __construct(
Data $dataHelper,
Factory $templateFactory,
ScopeConfigInterface $scopeConfig,
StoreManagerInterface $storeManager,
StateInterface $inlineTranslation,
TransportBuilder $transportBuilder
) {
$this->dataHelper = $dataHelper;
$this->templateFactory = $templateFactory;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->inlineTranslation = $inlineTranslation;
$this->_transportBuilder = $transportBuilder;
}
/**
* @param Mixed $senderInfo
* @param Mixed $receiverInfo
* @return $this
* @throws NoSuchEntityException
*/
public function generateTemplate($senderInfo, $receiverInfo)
{
$templateId = $this->getTemplateId(self::XML_PATH_EMAIL_TEMPLATE_MAGENTO_TEST);
$this->getTransportBuilder()
->setTemplateIdentifier($templateId)
->setTemplateOptions(
[
'area' => Area::AREA_ADMINHTML,
'store' => $this->getStore()->getId(),
]
)
->setTemplateVars($this->templateVars)
->setFrom($senderInfo)
->addTo($receiverInfo['email'], $receiverInfo['name']);
return $this;
}
/**
* @param $senderInfo
* @param $receiverInfo
* @throws MailException
* @throws NoSuchEntityException
* @throws LocalizedException
*/
public function send($senderInfo, $receiverInfo)
{
$this->inlineTranslation->suspend();
$this->generateTemplate($senderInfo, $receiverInfo);
$transport = $this->_transportBuilder->getTransport();
$result = $transport->sendMessage();
$this->inlineTranslation->resume();
return $result;
}
/**
* @return TemplateInterface
* @throws NoSuchEntityException
*/
protected function getTemplate()
{
$this->setTemplateOptions(
[
'area' => Area::AREA_ADMINHTML,
'store' => $this->getStore()->getId(),
]
);
$templateIdentifier = $this->getTemplateId(self::XML_PATH_EMAIL_TEMPLATE_ZEND_TEST);
return $this->templateFactory->get($templateIdentifier, $this->templateModel)
->setVars($this->templateVars)
->setOptions($this->templateOptions);
}
/**
* @return mixed
* @throws NoSuchEntityException
*/
public function getEmailBody()
{
return $this->getTemplate()->processTemplate();
}
/**
* Return template id according to store
*
* @param $xmlPath
* @return mixed
* @throws NoSuchEntityException
*/
public function getTemplateId($xmlPath)
{
return $this->getConfigValue($xmlPath, $this->getStore()->getStoreId());
}
/**
* Return store configuration value of your template field that which id you set for template
*
* @param string $path
* @param int $storeId
* @return mixed
*/
protected function getConfigValue($path, $storeId)
{
return $this->scopeConfig->getValue(
$path,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* Return store
*
* @return StoreInterface
* @throws NoSuchEntityException
*/
public function getStore()
{
return $this->storeManager->getStore();
}
/**
* @param mixed $templateVars
* @return Email
*/
public function setTemplateVars($templateVars)
{
$this->templateVars = (array) $templateVars;
return $this;
}
/**
* @param mixed $templateOptions
* @return Email
*/
public function setTemplateOptions($templateOptions)
{
$this->templateOptions = (array) $templateOptions;
return $this;
}
/**
* Set template model
*
* @param string $templateModel
* @return $this
*/
public function setTemplateModel($templateModel)
{
$this->templateModel = $templateModel;
return $this;
}
/**
* @return TransportBuilder
*/
public function getTransportBuilder()
{
return $this->_transportBuilder;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Model;
class Store
{
/** @var int/null */
protected $store_id = null;
/**
* @var null
*/
protected $from = null;
/**
* @return int|null
*/
public function getStoreId()
{
return $this->store_id;
}
/**
* @param $store_id
* @return $this
*/
public function setStoreId($store_id)
{
$this->store_id = $store_id;
return $this;
}
/**
* @return string|array
*/
public function getFrom()
{
return $this->from;
}
/**
* @param string|array $from
* @return $this
*/
public function setFrom($from)
{
$this->from = $from;
return $this;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Model;
use Exception;
use InvalidArgumentException;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Mail\MessageInterface;
use Magento\Framework\Mail\TransportInterface;
use Magento\Framework\Phrase;
use Zend_Mail;
use Zend_Mail_Transport_Sendmail;
class Transport extends Zend_Mail_Transport_Sendmail implements TransportInterface
{
/**
* @var MessageInterface
*/
protected $_message;
/**
* @param MessageInterface $message
* @param null $parameters
*/
public function __construct(MessageInterface $message, $parameters = null)
{
if (!$message instanceof Zend_Mail) {
throw new InvalidArgumentException('The message should be an instance of \Zend_Mail');
}
parent::__construct($parameters);
$this->_message = $message;
}
/**
* Send a mail using this transport
*
* @return void
* @throws MailException
*/
public function sendMessage()
{
try {
parent::send($this->_message);
} catch (Exception $e) {
throw new MailException(new Phrase($e->getMessage()), $e);
}
}
/**
* @return MessageInterface|Zend_Mail
*/
public function getMessage()
{
return $this->_message;
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Plugin\Mail\Template;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Mail\Template\SenderResolverInterface;
use Magento\Framework\Mail\Template\TransportBuilderByStore;
use MagePal\GmailSmtpApp\Model\Store;
class TransportBuilderByStorePlugin
{
/**
* @var Store
*/
protected $storeModel;
/**
* Sender resolver.
*
* @var SenderResolverInterface
*/
private $senderResolver;
/**
* @param Store $storeModel
* @param SenderResolverInterface $senderResolver
*/
public function __construct(
Store $storeModel,
SenderResolverInterface $senderResolver
) {
$this->storeModel = $storeModel;
$this->senderResolver = $senderResolver;
}
/**
* @param TransportBuilderByStore $subject
* @param $from
* @param $store
* @return array
* @throws MailException
*/
public function beforeSetFromByStore(
TransportBuilderByStore $subject,
$from,
$store
) {
if (!$this->storeModel->getStoreId()) {
$this->storeModel->setStoreId($store);
}
$email = $this->senderResolver->resolve($from, $store);
$this->storeModel->setFrom($email);
return [$from, $store];
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Plugin\Mail\Template;
use Magento\Framework\Mail\Template\TransportBuilder;
use MagePal\GmailSmtpApp\Model\Store;
class TransportBuilderPlugin
{
/** @var Store */
protected $storeModel;
/**
* @param Store $storeModel
*/
public function __construct(
Store $storeModel
) {
$this->storeModel = $storeModel;
}
/**
* @param TransportBuilder $subject
* @param $templateOptions
* @return array
*/
public function beforeSetTemplateOptions(
TransportBuilder $subject,
$templateOptions
) {
if (array_key_exists('store', $templateOptions)) {
$this->storeModel->setStoreId($templateOptions['store']);
} else {
$this->storeModel->setStoreId(null);
}
return [$templateOptions];
}
}
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
namespace MagePal\GmailSmtpApp\Plugin\Mail;
use Closure;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Mail\EmailMessageInterface;
use Magento\Framework\Mail\Message;
use Magento\Framework\Mail\TransportInterface;
use MagePal\GmailSmtpApp\Helper\Data;
use MagePal\GmailSmtpApp\Mail\SmtpFactory;
use MagePal\GmailSmtpApp\Mail\Smtp;
use MagePal\GmailSmtpApp\Model\Store;
use Zend_Mail_Exception;
class TransportPlugin
{
/**
* @var Data
*/
protected Data $dataHelper;
/**
* @var Store
*/
protected $storeModel;
/**
* @var Smtp
*/
private SmtpFactory $smtpFactory;
/**
* @param Data $dataHelper
* @param Store $storeModel
* @param SmtpFactory $smtpFactory
*/
public function __construct(
Data $dataHelper,
Store $storeModel,
SmtpFactory $smtpFactory
) {
$this->dataHelper = $dataHelper;
$this->storeModel = $storeModel;
$this->smtpFactory = $smtpFactory;
}
/**
* @param TransportInterface $subject
* @param Closure $proceed
* @throws MailException
* @throws Zend_Mail_Exception
*/
public function aroundSendMessage(
TransportInterface $subject,
Closure $proceed
) {
if ($this->dataHelper->isActive()) {
if (method_exists($subject, 'getStoreId')) {
$this->storeModel->setStoreId($subject->getStoreId());
}
$message = $subject->getMessage();
if ($message instanceof Message || $message instanceof EmailMessageInterface) {
$smtp = $this->smtpFactory->create(
['dataHelper' => $this->dataHelper, 'storeModel' => $this->storeModel]
);
$smtp->sendSmtpMessage($message);
} else {
$proceed();
}
} else {
$proceed();
}
}
}
<a href="https://www.magepal.com" title="Magento Extensions" ><img src="https://image.ibb.co/dHBkYH/Magepal_logo.png" width="100" align="right" title="Magento Custom Modules" /></a>
# Magento 2 SMTP Extension - Gmail, G Suite, Amazon SES, Office 365, Mailgun, SendGrid, Mandrill and other SMTP servers.
[![Total Downloads](https://poser.okvpn.org/magepal/magento2-gmailsmtpapp/downloads)](https://www.magepal.com/magento2/extensions/custom-smtp.html)
[![Latest Stable Version](https://poser.okvpn.org/magepal/magento2-gmailsmtpapp/v/stable)](https://www.magepal.com/magento2/extensions/custom-smtp.html)
[![GitHub stars](https://img.shields.io/github/stars/magepal/magento2-gmail-smtp-app.svg)](https://www.magepal.com/magento2/extensions/custom-smtp.html)
[![GitHub forks](https://img.shields.io/github/forks/magepal/magento2-gmail-smtp-app.svg)](https://www.magepal.com/magento2/extensions/custom-smtp.html)
##### For Magento 2.0.x, 2.1.x, 2.2.x, 2.3.x and 2.4.x
Configure Magento 2 to send all transactional emails using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 or any other SMTP servers.
<a href="https://bit.ly/mp-gh-smpt"><img src="https://user-images.githubusercontent.com/1415141/90457464-9a4ce380-e0c9-11ea-8aea-61d4f7cb679b.jpg" alt="Magento SMTP Extension" /></a>
Sending transactional emails to customers is a vital part of running an e-commerce store. Our free custom Magento extension integrates with all major email service providers and third-party SMTP servers to reliably deliver messages to customers' inboxes.
#### What is SMTP - Simple Mail Transfer Protocol
SMTP or Simple Mail Transfer Protocol allows you to send emails from your Magento 2 store through a specific third-party mail SMTP server. For example, if you want to use your Gmail, Amazon, Microsoft or any other mail server account to send email from your Magento web store, all you need is to configure that mail server setting in our extension in Magento without having to do any complex server configuration.
<a href="https://bit.ly/mp-gh-smpt"><img src="https://image.ibb.co/ecWinc/Mage_Pal_Magento_2_SMTP_Extension.gif" alt="Magento SMTP Email Extension" /></a>
#### Why use a Custom SMTP Server with Magento
By default, most hosting companies' mail servers are configured to send email from unauthorized senders which prevents emails from reliable delivered to recipients. Therefore, most Magento store owners struggle to limit the number of transactional emails that end up in clients' junk mail. Take full control of your email sending settings in Magento 2 and reduce sending emails to your valuable customers' junk mail folder. Emails are delivered instantaneously to their intended recipients without delays or get trap in the spam folder.
Out of the box, Magento 2 doesn't provide the ability to specify your custom SMTP settings for outgoing emails using an external SMTP server. Using this extension bridges the gap and allows your Magento store to connect to your preferred email provider securely and easily.
All you need is either an (i) free Gmail account, (ii) paid Google Apps account or any other SMTP service (i.e Amazon Simple Email Service / Amazon SES, Microsoft Office365).
Learn more about our [custom SMTP](https://www.magepal.com/magento2/extensions/custom-smtp.html?utm_source=Custom%20SMTP&utm_medium=GitHub%20Learn%20More) extension.
> ### NOTE - Gmail / Google Account
>To help keep your account secure, starting May 30, 2022, ​​Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.
>Please note this deadline does not apply to Google Workspace or Google Cloud Identity customers. The enforcement date for these customers will be announced on the Workspace blog at a later date.
>For more information, please continue reading.
>Special Note on Apple Device Sign-Ins. Users who have not recently signed into their Google Account using only username and password will be able to only make new sign in attempts using the Google account type starting from February 28, 2022. Existing users may continue to sign into their Google Account using their username and password until May 30, 2022.
### Benefits of using Gmail SMTP
Since Google's, Gmail and G Suite SMTP server does not use Port 25, you'll reduce the probability that an ISP might block your email or flag it as SPAM. Also, all your emails sent from Magento will be searchable and backed-up in your email account on Google's servers.
### Features
* Send emails through virtually any external SMTP server from your Magento store
* Easily configure Magento 2 SMTP settings from within Magento2 store admin
* Complete control of custom SMTP server settings: Hostname, Port, Username, Password, ...
* Self-test option, which lets you verify your email credentials are correct before saving
* Support Multi-store, configurable different email providers/accounts per store
* Support secure SMTP servers: TLS / SSL, Plain-text, username/password, CRAM-MD5 authentication
* Customize email headers: From / Reply-To / Return-Path
* Easily disable/enable our extension from admin
* Developer Friendly
* Integrate with any third-party SMTP server
Get more from your order confirmation emails by promoting other complementary products and services.
Learn more about our new <a href="https://www.magepal.com/enhanced-transactional-emails.html?utm_source=ete&utm_medium=GitHub%20Learn%20More" target="_blank">Enhanced Transactional Email</a> extension.
### Documentation
- [How to Install SMTP Magento 2 Extension](https://www.magepal.com/help/docs/smtp-magento/?utm_source=smtp&utm_medium=github#installation)
- [How to setup Magento 2 SMTP Extension](https://www.magepal.com/help/docs/smtp-magento/?utm_source=smtp&utm_medium=github#configuration)
- [How to debugging Magento 2 SMTP Extension](https://www.magepal.com/help/docs/smtp-magento/?utm_source=smtp&utm_medium=github#debug)
### SMTP Service Providers
* Gmail
* Google App
* G Suite
* Amazon Simple Email Service (SES)
* Microsoft Office365
* Outlook
* SparkPost
* GoDaddy
* Mandrill
* MailGun
* SendGrid
* Elastic Email
* Hotmail
* AOL Mail
* Yahoo Mail
* AT&T
* Verizon
* Postmark
* O2 Mail
* Zoho
* Mailjet
* Mail.com
* Your Company SMTP Server
* and many other SMTP servers
### How to Install Magento SMTP Extension
##### Using Composer (recommended)
```sh
composer require magepal/magento2-gmailsmtpapp
```
Contribution
---
Want to contribute to this extension? The quickest way is to open a [pull request on GitHub](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests).
Support
---
If you encounter any problems or bugs, please open an issue on [GitHub](https://github.com/magepal/magento2-gmail-smtp-app/issues). For fast Premium Support visit our [Custom SMTP Extension](https://www.magepal.com/magento2/extensions/custom-smtp.html?utm_source=Custom%20SMTP&utm_medium=GitHub%20Premium%20Support) product page for detail.
Need help setting up or want to customize this extension to meet your business needs? Please email support@magepal.com and if we like your idea we will add this feature for free or at a discounted rate.
Magento 2 Extensions
---
- [Custom SMTP](https://www.magepal.com/magento2/extensions/custom-smtp.html)
- [Catalog Hover Image for Magento](https://www.magepal.com/magento2/extensions/catalog-hover-image-for-magento.html)
- [Enhanced Success Page for Magento 2](https://www.magepal.com/magento2/extensions/enhanced-success-page.html)
- [Enhanced Transactional Emails for Magento 2](https://www.magepal.com/magento2/extensions/enhanced-transactional-emails.html)
- [Google Tag Manager](https://www.magepal.com/magento2/extensions/google-tag-manager.html)
- [Enhanced E-commerce](https://www.magepal.com/magento2/extensions/enhanced-ecommerce-for-google-tag-manager.html)
- [Reindex](https://www.magepal.com/magento2/extensions/reindex.html)
- [Custom Shipping Method](https://www.magepal.com/magento2/extensions/custom-shipping-rates-for-magento-2.html)
- [Preview Order Confirmation](https://www.magepal.com/magento2/extensions/preview-order-confirmation-page-for-magento-2.html)
- [Guest to Customer](https://www.magepal.com/magento2/extensions/guest-to-customer.html)
- [Admin Form Fields Manager](https://www.magepal.com/magento2/extensions/admin-form-fields-manager-for-magento-2.html)
- [Customer Dashboard Links Manager](https://www.magepal.com/magento2/extensions/customer-dashboard-links-manager-for-magento-2.html)
- [Lazy Loader](https://www.magepal.com/magento2/extensions/lazy-load.html)
- [Order Confirmation Page Miscellaneous Scripts](https://www.magepal.com/magento2/extensions/order-confirmation-miscellaneous-scripts-for-magento-2.html)
- [HTML Minifier for Magento2](https://www.magepal.com/magento2/extensions/html-minifier.html)
© MagePal LLC. | [www.magepal.com](https://www.magepal.com)
{
"name": "magepal/magento2-gmailsmtpapp",
"description":"Magento 2 SMTP Extension - Configure Magento 2 to send all transactional email using Gmail, G Suite, Amazon SES, Office360, Mailgun, SendGrid, Mandrill or any other SMTP servers",
"keywords": [
"magento 2",
"gmail smtp",
"google app",
"magento2 email",
"Amazon Simple Email Service",
"Amazon SES",
"magento2 smtp",
"magento2 email setup",
"send email magento2",
"g suite",
"how to configure magento email",
"how to setup email magento2"
],
"require": {
"php": "~7.4.0||~8.1.0",
"magento/module-backend": "102.0.*",
"magento/framework": "103.0.*",
"magepal/magento2-core":">1.1.0"
},
"type": "magento2-module",
"version": "2.9.0",
"license": [
"proprietary"
],
"homepage": "https://www.magepal.com/",
"support": {
"email": "support@magepal.com",
"issues": "https://github.com/magepal/magento2-gmail-smtp-app/issues/"
},
"authors": [
{
"name": "Renon Stewart",
"email": "renon@magepal.com",
"homepage": "https://www.magepal.com/",
"role": "Leader"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"MagePal\\GmailSmtpApp\\": ""
}
}
}
<?xml version="1.0" ?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="MagePal_GmailSmtpApp::magepal_gmailsmtpapp" title="MagePal SMTP App"/>
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="magepalSmtp" frontName="magepalsmtp">
<module name="MagePal_GmailSmtpApp" before="Magento_Backend" />
</route>
</router>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<system>
<gmailsmtpapp>
<active>0</active>
<name>localhost</name>
<ssl>ssl</ssl>
<auth>LOGIN</auth>
<smtphost>smtp.gmail.com</smtphost>
<smtpport>465</smtpport>
<set_return_path>1</set_return_path>
<set_reply_to>1</set_reply_to>
<set_from>0</set_from>
<password backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
<zend_email_template>magepal_smtp_zend_email_test</zend_email_template>
<magento_email_template>magepal_smtp_magento_email_test</magento_email_template>
</gmailsmtpapp>
</system>
</default>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
-->
<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\GmailSmtpApp\Model\Transport"/>
<type name="MagePal\GmailSmtpApp\Model\Transport">
<plugin sortOrder="100" name="magePalGmailSmtpAppTransport" type="MagePal\GmailSmtpApp\Plugin\Mail\TransportPlugin"/>
</type>
<!-- For Magento Eq 2.2 -->
<type name="Magento\Framework\Mail\TransportInterface">
<plugin sortOrder="100" name="magePalGmailSmtpAppTransportInterface" type="MagePal\GmailSmtpApp\Plugin\Mail\TransportPlugin"/>
</type>
<type name="Magento\Framework\Mail\Template\TransportBuilder">
<plugin sortOrder="1" name="magePalGmailSmtpAppTransportBuilder"
type="MagePal\GmailSmtpApp\Plugin\Mail\Template\TransportBuilderPlugin"/>
</type>
<type name="Magento\Framework\Mail\Template\TransportBuilderByStore">
<plugin sortOrder="1" name="magePalGmailSmtpAppTransportBuilderByStore"
type="MagePal\GmailSmtpApp\Plugin\Mail\Template\TransportBuilderByStorePlugin"/>
</type>
<type name="Magento\Config\Model\Config\TypePool">
<arguments>
<argument name="environment" xsi:type="array">
<item name="system/gmailsmtpapp/active" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/ssl" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/auth" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/smtphost" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/smtpport" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/username" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/password" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/set_reply_to" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/set_from" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/custom_from_email" xsi:type="string">1</item>
<item name="system/gmailsmtpapp/return_path_email" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
<template id="magepal_smtp_zend_email_test" label="Test Email using Zend Framework" file="zend_email_test.html" type="html" module="MagePal_GmailSmtpApp" area="adminhtml"/>
<template id="magepal_smtp_magento_email_test" label="Test Email using Magento Framework" file="magento_email_test.html" type="html" module="MagePal_GmailSmtpApp" area="adminhtml"/>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MagePal_GmailSmtpApp" setup_version="1.5.1">
<sequence>
<module name="Magento_Email"/>
<module name="Magento_Backend" />
<module name="Magento_Config" />
<module name="Magento_Store" />
<module name="MagePal_Core"/>
</sequence>
</module>
</config>
"SMTP Configuration","SMTP Configuration"
"Module Version","Module Version"
"Composer Version","Composer Version"
"Configuration","Configuration"
"Version","Version"
"Enable","Enable"
"Local client name (domain or IP)","Local client name (domain or IP)"
"Default: localhost","Default: localhost"
"Authentication method","Authentication method"
"Use ""login"" for Gmail or Google Apps.","Use ""login"" for Gmail or Google Apps."
"SSL type","SSL type"
"Use ""ssl"" for Gmail or Google Apps.","Use ""ssl"" for Gmail or Google Apps."
"SMTP Host","SMTP Host"
"SMTP Port","SMTP Port"
"Use 465 (ssl) or 587 (tls) if port 25 is throttled or blocked.","Use 465 (ssl) or 587 (tls) if port 25 is throttled or blocked."
"Username","Username"
"Email Address or Account ID.","Email Address or Account ID."
"Password","Password"
"Set Reply-to","Set Reply-to"
"Set From","Set From"
"Use Return-Path email address for the From address rather than the Magento supplied value.","Use Return-Path email address for the From address rather than the Magento supplied value."
"Set Return-Path","Set Return-Path"
"Return-Path Email","Return-Path Email"
"Test Email Server Configuration Settings","Test Email Server Configuration Settings"
"Email address","Email address"
"Email address to send test to.","Email address to send test to."
"From Email Address","From Email Address"
"Leave blank to use Username instead","Leave blank to use Username instead"
"Send Test Email","Send Test Email"
"Stores > Configuration > Advanced > System","Stores > Configuration > Advanced > System"
"None","None"
"SSL (Gmail / Google Apps)","SSL (Gmail / Google Apps)"
"TLS (Gmail / Google Apps)","TLS (Gmail / Google Apps)"
"Please check your email","Please check your email"
"and flush your Magento cache","and flush your Magento cache"
"Please enter a valid username/password","Please enter a valid username/password"
"""Disable Email Communications"" is set is ""Yes"", please set to ""NO"" in ""Mail Sending Setting""","""Disable Email Communications"" is set is ""Yes"", please set to ""NO"" in ""Mail Sending Setting"""
"SMTP module is not enabled","SMTP module is not enabled"
"Stores > Configuration > Advanced > System > SMTP Configuration and Settings","Stores > Configuration > Advanced > System > SMTP Configuration and Settings"
"From Email Address","From Email Address"
"Use specify From Address instead of Magento supplied value.","Use specify From Address instead of Magento supplied value."
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'MagePal_GmailSmtpApp',
__DIR__
);
<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="MagePal\GmailSmtpApp\Block\Adminhtml\ValidateConfig" name="magepal.smtp_validate"
template="MagePal_GmailSmtpApp::validateConfig/result.phtml" />
</container>
</layout>
var config = {
map: {
'*': {
magePalGmailSmtpAppValidateConfig: 'MagePal_GmailSmtpApp/js/validate-config'
}
}
};
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
?>
<?php /** @var $block MagePal\GmailSmtpApp\Block\Adminhtml\System\Config\ValidateConfigButton **/ ?>
<?= $block->getButtonHtml() ?>
<script type="text/x-magento-init">
{
"#gmailsmtpapp_debug_result_button": {
"magePalGmailSmtpAppValidateConfig": {
"postUrl":"<?= $block->escapeUrl($block->getAdminUrl()) ?>"
}
}
}
</script>
<?php
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* https://www.magepal.com | support@magepal.com
*/
?>
<style>
svg {
width: 50px;
display: block;
margin: 20px auto 0;
}
.path {
stroke-dasharray: 1000;
stroke-dashoffset: 0;
}
.path.circle {
-webkit-animation: dash 0.9s ease-in-out;
animation: dash 0.9s ease-in-out;
}
.path.line {
stroke-dashoffset: 1000;
-webkit-animation: dash 0.9s 0.35s ease-in-out forwards;
animation: dash 0.9s 0.35s ease-in-out forwards;
}
.path.check {
stroke-dashoffset: -100;
-webkit-animation: dash-check 0.9s 0.35s ease-in-out forwards;
animation: dash-check 0.9s 0.35s ease-in-out forwards;
}
.modal-popup p {
text-align: center;
margin: 20px 0 30px;
font-size: 1.25em;
}
.modal-popup p.success {
color: #73AF55;
font-size: 1.75em;
}
.modal-popup p.error {
color: #D06079;
}
h2.center {
text-align: center;
}
@-webkit-keyframes dash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes dash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@-webkit-keyframes dash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
@keyframes dash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
p.external-link {
font-style: italic;
}
div.error-wrapper {
max-height: 300px;
overflow: scroll;
margin-bottom: 40px;
}
div.error-wrapper p {
text-align: left;
}
.modal-popup.confirm .modal-inner-wrap {
width: 85rem;
padding-right: 25px;
}
.modal-popup.confirm .modal-inner-wrap .modal-content {
padding-right: 0;
}
hr.style {
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
margin-bottom: 30px;
}
.tg {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
border: none;
margin-bottom: 50px;
}
.tg td {
font-family: Arial, sans-serif;
font-size: 14px;
padding: 15px 5px;
border: none;
overflow: hidden;
word-break: normal;
}
.tg th {
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
padding: 15px 5px;
border-width: 1px;
overflow: hidden;
word-break: normal;
}
.tg .tg-baqh {
text-align: center;
vertical-align: top
}
</style>
<!--[if lte IE 9]>
<style>
.path {stroke-dasharray: 0 !important;}
</style>
<![endif]-->
<?php /** @var $block MagePal\GmailSmtpApp\Block\Adminhtml\ValidateConfig */ ?>
<?php foreach ($block->verify() as $result): ?>
<?php if ($result['has_error'] === false): ?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2">
<circle class="path circle" fill="none" stroke="#73AF55" stroke-width="6" stroke-miterlimit="10" cx="65.1"
cy="65.1" r="62.1"/>
<polyline class="path check" fill="none" stroke="#73AF55" stroke-width="6" stroke-linecap="round"
stroke-miterlimit="10" points="100.2,40.2 51.5,88.8 29.8,67.5 "/>
</svg>
<p class="success">Congratulations, You Did It!</p>
<p><?= $block->escapeHtml($result['msg']) ?></p>
<hr class="style" />
<h2 class="center">What next? Take a look at our other top extensions.</h2>
<table class="tg">
<tbody><tr>
<td class="tg-baqh" colspan="2">
<a href="https://bit.ly/smtp-ex-ee" target="_blank">Enhanced E-commerce for Google Tag Manager</a>
</td>
</tr><tr>
<th class="tg-baqh">
<a href="https://bit.ly/smtp-ex-esp" target="_blank">Enhanced Success Page</a>
</th>
<th class="tg-baqh">
<a href="https://bit.ly/smtp-ex-ete" target="_blank">Enhanced Sales Email</a>
</th>
</tr>
</tr>
</tbody>
</table>
<?php else: ?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2">
<circle class="path circle" fill="none" stroke="#D06079" stroke-width="6" stroke-miterlimit="10" cx="65.1"
cy="65.1" r="62.1"/>
<line class="path line" fill="none" stroke="#D06079" stroke-width="6" stroke-linecap="round"
stroke-miterlimit="10" x1="34.4" y1="37.9" x2="95.8" y2="92.3"/>
<line class="path line" fill="none" stroke="#D06079" stroke-width="6" stroke-linecap="round"
stroke-miterlimit="10" x1="95.8" y1="38" x2="34.4" y2="92.2"/>
</svg>
<p class="error">Bummer!</p>
<div class="error-wrapper">
<p><?= $block->escapeHtml($block->formatErrorMsg($result['msg']), ['a']) ?> </p>
</div>
<hr class="style"/>
<h2 class="center">Need help with configuring your SMTP?</h2>
<p>
Our affordable technical support include help with installation, usage, configuration, and troubleshooting
our Free Open Source extensions.
</p>
<p>
Visit <a href="http://bit.ly/MpSmtpEr" target="_blank">www.magepal.com</a> to learn more about our
<a href="http://bit.ly/MpSmtpEr"
target="_blank">Premium 30 Minutes Paid Support</a>.
</p>
<?php endif; ?>
<?php endforeach; ?>
svg {
width: 50px;
display: block;
margin: 20px auto 0;
}
.path {
stroke-dasharray: 1000;
stroke-dashoffset: 0;
&.circle {
-webkit-animation: dash .9s ease-in-out;
animation: dash .9s ease-in-out;
}
&.line {
stroke-dashoffset: 1000;
-webkit-animation: dash .9s .35s ease-in-out forwards;
animation: dash .9s .35s ease-in-out forwards;
}
&.check {
stroke-dashoffset: -100;
-webkit-animation: dash-check .9s .35s ease-in-out forwards;
animation: dash-check .9s .35s ease-in-out forwards;
}
}
.modal-popup {
p {
text-align: center;
margin: 20px 0 60px;
font-size: 1.25em;
&.success {
color: #73AF55;
}
&.error {
color: #D06079;
}
}
}
@-webkit-keyframes dash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes dash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@-webkit-keyframes dash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
@keyframes dash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
/**
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | support@magepal.com
*/
define([
'jquery',
'Magento_Ui/js/modal/alert'
], function ($, alert) {
var formSubmit = function (config) {
var postData = {
form_key: FORM_KEY
};
/** global var configForm **/
configForm.find('[id^=system_gmailsmtpapp]').find(':input').serializeArray().map(function (field) {
var name = field.name.match(/groups\[gmailsmtpapp\]?(\[groups\]\[debug\])?\[fields\]\[(.*)\]\[value]/);
/**
* groups[gmailsmtpapp][groups][debug][fields][email][value]
* groups[gmailsmtpapp][fields][password][value]
*/
if (name && name.length === 3) {
postData[name[2]] = field.value;
}
});
$.ajax({
url: config.postUrl,
type: 'post',
dataType: 'html',
data: postData,
showLoader: true
}).done(function (response) {
if (typeof response === 'object') {
if (response.error) {
alert({ title: 'Error', content: response.message });
} else if (response.ajaxExpired) {
window.location.href = response.ajaxRedirect;
}
} else {
alert({
title:'',
content:response,
buttons: []
});
}
});
};
return function (config, element) {
$(element).on('click', function () {
formSubmit(config);
});
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment