Version Notes
Send magento emails by protocol SMTP or save them to a files.
Download this release
Release Info
Developer | Marcin Frymark |
Extension | mail_transport |
Version | 0.1.0.0 |
Comparing to | |
See all releases |
Version 0.1.0.0
- app/code/community/Alekseon/AdminNotification/Block/Adminhtml/System/Config/Form/Field/Notification.php +16 -0
- app/code/community/Alekseon/AdminNotification/Helper/Data.php +10 -0
- app/code/community/Alekseon/AdminNotification/Model/Feed.php +95 -0
- app/code/community/Alekseon/AdminNotification/Model/Observer.php +18 -0
- app/code/community/Alekseon/AdminNotification/etc/adminhtml.xml +31 -0
- app/code/community/Alekseon/AdminNotification/etc/config.xml +48 -0
- app/code/community/Alekseon/AdminNotification/etc/system.xml +74 -0
- app/code/community/Alekseon/MailTransport/Helper/Data.php +10 -0
- app/code/community/Alekseon/MailTransport/Model/Email/Template.php +84 -0
- app/code/community/Alekseon/MailTransport/Model/System/Config/Source/EncryptionProtocols.php +24 -0
- app/code/community/Alekseon/MailTransport/Model/System/Config/Source/MailTransportTypes.php +25 -0
- app/code/community/Alekseon/MailTransport/Model/System/Config/Source/SmtpAuthModes.php +25 -0
- app/code/community/Alekseon/MailTransport/etc/adminhtml.xml +31 -0
- app/code/community/Alekseon/MailTransport/etc/config.xml +1 -1
- app/code/community/Alekseon/MailTransport/etc/system.xml +120 -0
- app/etc/modules/Alekseon_AdminNotification.xml +21 -0
- app/etc/modules/Alekseon_MailTrasnport.xml +17 -0
- package.xml +18 -0
app/code/community/Alekseon/AdminNotification/Block/Adminhtml/System/Config/Form/Field/Notification.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_AdminNotification_Block_Adminhtml_System_Config_Form_Field_Notification extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
+
{
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$element->setValue(Mage::app()->loadCache(Alekseon_AdminNotification_Model_Feed::NOTIFICANTION_LASTCHECK_CACHE_KEY));
|
13 |
+
$format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
14 |
+
return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Alekseon/AdminNotification/Helper/Data.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_AdminNotification_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
}
|
app/code/community/Alekseon/AdminNotification/Model/Feed.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_AdminNotification_Model_Feed extends Mage_AdminNotification_Model_Feed
|
9 |
+
{
|
10 |
+
const XML_ENABLED_PATH = 'alekseon_adminNotification/general/enabled';
|
11 |
+
const XML_FREQUENCY_PATH = 'alekseon_adminNotification/general/frequency';
|
12 |
+
const NOTIFICANTION_LASTCHECK_CACHE_KEY = 'alekseon_notifications_lastcheck';
|
13 |
+
|
14 |
+
protected $_alekseonInstalledModules;
|
15 |
+
|
16 |
+
public function getFeedUrl()
|
17 |
+
{
|
18 |
+
if (is_null($this->_feedUrl)) {
|
19 |
+
$this->_feedUrl = Mage::helper('alekseon_core')->getAlekseonUrl() . '/rss/magento_rss.xml';
|
20 |
+
$query = '?utm_source=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
|
21 |
+
$query .= '&utm_medium=' . urlencode('Magento Connect');
|
22 |
+
$query .= '&utm_content=' . urlencode(Mage::getEdition() . ' ' . Mage::getVersion());
|
23 |
+
$query .= '&utm_term=' . urlencode(implode(',', $this->_getAlekseonInstalledModules()));
|
24 |
+
|
25 |
+
$this->_feedUrl .= $query;
|
26 |
+
}
|
27 |
+
|
28 |
+
return $this->_feedUrl;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function checkUpdate()
|
32 |
+
{
|
33 |
+
if (!Mage::getStoreConfig(self::XML_ENABLED_PATH)) {
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
$feedData = array();
|
42 |
+
$feedXml = $this->getFeedData();
|
43 |
+
|
44 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
45 |
+
foreach ($feedXml->channel->item as $item) {
|
46 |
+
|
47 |
+
$module = (string)$item->module;
|
48 |
+
if ($module && !in_array($module, $this->_getAlekseonInstalledModules())) {
|
49 |
+
continue;
|
50 |
+
}
|
51 |
+
|
52 |
+
$feedData[] = array(
|
53 |
+
'severity' => (int)$item->severity,
|
54 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
55 |
+
'title' => (string)$item->title,
|
56 |
+
'description' => (string)$item->description,
|
57 |
+
'url' => (string)$item->link,
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
if ($feedData) {
|
62 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
+
$this->setLastUpdate();
|
67 |
+
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getLastUpdate()
|
72 |
+
{
|
73 |
+
return Mage::app()->loadCache(self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
|
74 |
+
}
|
75 |
+
|
76 |
+
public function setLastUpdate()
|
77 |
+
{
|
78 |
+
Mage::app()->saveCache(time(), self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function _getAlekseonInstalledModules()
|
83 |
+
{
|
84 |
+
if (is_null($this->_alekseonInstalledModules)) {
|
85 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
86 |
+
$this->_alekseonInstalledModules = array();
|
87 |
+
foreach ($modules as $moduleName) {
|
88 |
+
if (substr($moduleName, 0, 9) == 'Alekseon_'){
|
89 |
+
$this->_alekseonInstalledModules[] = $moduleName;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
return $this->_alekseonInstalledModules;
|
94 |
+
}
|
95 |
+
}
|
app/code/community/Alekseon/AdminNotification/Model/Observer.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_AdminNotification_Model_Observer
|
9 |
+
{
|
10 |
+
public function preDispatch(Varien_Event_Observer $observer)
|
11 |
+
{
|
12 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
13 |
+
$feedModel = Mage::getModel('alekseon_adminNotification/feed');
|
14 |
+
$feedModel->checkUpdate();
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Alekseon/AdminNotification/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<alekseon_adminNotification translate="title">
|
20 |
+
<title>Alekseon Notifications</title>
|
21 |
+
<sort_order>10</sort_order>
|
22 |
+
</alekseon_adminNotification>
|
23 |
+
</children>
|
24 |
+
</config>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</children>
|
28 |
+
</admin>
|
29 |
+
</resources>
|
30 |
+
</acl>
|
31 |
+
</config>
|
app/code/community/Alekseon/AdminNotification/etc/config.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Alekseon_AdminNotification>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Alekseon_AdminNotification>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<models>
|
18 |
+
<alekseon_adminNotification>
|
19 |
+
<class>Alekseon_AdminNotification_Model</class>
|
20 |
+
</alekseon_adminNotification>
|
21 |
+
</models>
|
22 |
+
<helpers>
|
23 |
+
<alekseon_adminNotification>
|
24 |
+
<class>Alekseon_AdminNotification_Helper</class>
|
25 |
+
</alekseon_adminNotification>
|
26 |
+
</helpers>
|
27 |
+
</global>
|
28 |
+
<adminhtml>
|
29 |
+
<events>
|
30 |
+
<controller_action_predispatch>
|
31 |
+
<observers>
|
32 |
+
<alekseon_adminNotification>
|
33 |
+
<class>alekseon_adminNotification/observer</class>
|
34 |
+
<method>preDispatch</method>
|
35 |
+
</alekseon_adminNotification>
|
36 |
+
</observers>
|
37 |
+
</controller_action_predispatch>
|
38 |
+
</events>
|
39 |
+
</adminhtml>
|
40 |
+
<default>
|
41 |
+
<alekseon_adminNotification>
|
42 |
+
<general>
|
43 |
+
<enabled>1</enabled>
|
44 |
+
<frequency>12</frequency>
|
45 |
+
</general>
|
46 |
+
</alekseon_adminNotification>
|
47 |
+
</default>
|
48 |
+
</config>
|
app/code/community/Alekseon/AdminNotification/etc/system.xml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<tabs>
|
12 |
+
<alekseon>
|
13 |
+
<label>Alekseon</label>
|
14 |
+
<sort_order>450</sort_order>
|
15 |
+
</alekseon>
|
16 |
+
</tabs>
|
17 |
+
<sections>
|
18 |
+
<alekseon_adminNotification translate="label" module="alekseon_adminNotification">
|
19 |
+
<label>Alekseon Notifications</label>
|
20 |
+
<tab>alekseon</tab>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<groups>
|
27 |
+
<hint>
|
28 |
+
<frontend_model>alekseon_core/adminhtml_system_config_fieldset_alekseon</frontend_model>
|
29 |
+
<sort_order>0</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</hint>
|
34 |
+
<general translate="label" module="alekseon_adminNotification">
|
35 |
+
<label>General Options</label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>0</show_in_website>
|
40 |
+
<show_in_store>0</show_in_store>
|
41 |
+
<fields>
|
42 |
+
<enabled translate="label">
|
43 |
+
<label>Enabled</label>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<sort_order>10</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>0</show_in_website>
|
49 |
+
<show_in_store>0</show_in_store>
|
50 |
+
</enabled>
|
51 |
+
<frequency translate="label">
|
52 |
+
<label>Update Frequency</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_notification_frequency</source_model>
|
55 |
+
<sort_order>20</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>0</show_in_website>
|
58 |
+
<show_in_store>0</show_in_store>
|
59 |
+
</frequency>
|
60 |
+
<last_update translate="label">
|
61 |
+
<label>Last Update</label>
|
62 |
+
<frontend_type>label</frontend_type>
|
63 |
+
<frontend_model>adminhtml/system_config_form_field_notification</frontend_model>
|
64 |
+
<sort_order>30</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>0</show_in_website>
|
67 |
+
<show_in_store>0</show_in_store>
|
68 |
+
</last_update>
|
69 |
+
</fields>
|
70 |
+
</general>
|
71 |
+
</groups>
|
72 |
+
</alekseon_adminNotification>
|
73 |
+
</sections>
|
74 |
+
</config>
|
app/code/community/Alekseon/MailTransport/Helper/Data.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_MailTransport_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/Email/Template.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_MailTransport_Model_Email_Template extends Mage_Core_Model_Email_Template
|
9 |
+
{
|
10 |
+
public function getMailTransportConfig($configField, $storeId)
|
11 |
+
{
|
12 |
+
return Mage::getStoreConfig('alekseon_mailTransport/general/' . $configField, $storeId);
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getMail($storeId = null)
|
16 |
+
{
|
17 |
+
if (is_null($this->_mail)) {
|
18 |
+
$this->_mail = parent::getMail();
|
19 |
+
$this->_mail->setDefaultTransport($this->_getTransport($storeId));
|
20 |
+
}
|
21 |
+
return $this->_mail;
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _getTransport($storeId = null)
|
25 |
+
{
|
26 |
+
$transport = null;
|
27 |
+
$transportType = $this->getMailTransportConfig('type', $storeId);
|
28 |
+
switch($transportType) {
|
29 |
+
case Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_SMTP:
|
30 |
+
$transport = $this->_getSmtpTransport($storeId);
|
31 |
+
break;
|
32 |
+
case Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_FILE:
|
33 |
+
$transport= $this->_getFileTranport($storeId);
|
34 |
+
break;
|
35 |
+
}
|
36 |
+
|
37 |
+
return $transport;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _getSmtpTransport($storeId = null)
|
41 |
+
{
|
42 |
+
$host = $this->getMailTransportConfig('smtp_host', $storeId);
|
43 |
+
$config = array(
|
44 |
+
'username' => $this->getMailTransportConfig('smtp_user', $storeId),
|
45 |
+
'password' => $this->getMailTransportConfig('smtp_password', $storeId),
|
46 |
+
'port' => $this->getMailTransportConfig('smtp_port', $storeId),
|
47 |
+
'auth' => $this->getMailTransportConfig('smtp_auth', $storeId),
|
48 |
+
);
|
49 |
+
|
50 |
+
$ssl = $this->getMailTransportConfig('smtp_ssl', $storeId);
|
51 |
+
if ($ssl) {
|
52 |
+
$config['ssl'] = $ssl;
|
53 |
+
}
|
54 |
+
|
55 |
+
$transport = new Zend_Mail_Transport_Smtp($host, $config);
|
56 |
+
return $transport;
|
57 |
+
}
|
58 |
+
|
59 |
+
protected function _getFileTranport($storeId = null)
|
60 |
+
{
|
61 |
+
$path = $this->getMailTransportConfig('file_path', $storeId);
|
62 |
+
if ($path) {
|
63 |
+
$path = implode(DS, explode('/', $path));
|
64 |
+
$path = implode(DS, explode('\\', $path));
|
65 |
+
$path = Mage::getBaseDir() . DS . $path;
|
66 |
+
}
|
67 |
+
|
68 |
+
$config = array(
|
69 |
+
'path' => $path,
|
70 |
+
//'callback' =>
|
71 |
+
);
|
72 |
+
$transport = new Zend_Mail_Transport_File($config);
|
73 |
+
return $transport;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function send($email, $name = null, array $variables = array())
|
77 |
+
{
|
78 |
+
if (isset($variables['store'])) {
|
79 |
+
$store = $variables['store'];
|
80 |
+
$this->getMail($store->getId());
|
81 |
+
}
|
82 |
+
return parent::send($email, $name, $variables);
|
83 |
+
}
|
84 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/System/Config/Source/EncryptionProtocols.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_MailTransport_Model_System_Config_Source_EncryptionProtocols
|
9 |
+
{
|
10 |
+
const ENCRYPTION_PROTOCOL_SSL = 'ssl';
|
11 |
+
const ENCRYPTION_PROTOCOL_TLS = 'tls';
|
12 |
+
|
13 |
+
public function toOptionArray()
|
14 |
+
{
|
15 |
+
$helper = Mage::helper('alekseon_mailTransport');
|
16 |
+
$options = array(
|
17 |
+
0 => $helper->__('No Encryption'),
|
18 |
+
self::ENCRYPTION_PROTOCOL_SSL => $helper->__('SSL - Secure Sockets Layer'),
|
19 |
+
self::ENCRYPTION_PROTOCOL_TLS => $helper->__('TLS - Transport Layer Security'),
|
20 |
+
);
|
21 |
+
return $options;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/System/Config/Source/MailTransportTypes.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes
|
9 |
+
{
|
10 |
+
const MAIL_TARNSPORT_TYPE_DEFAULT = 0;
|
11 |
+
const MAIL_TARNSPORT_TYPE_SMTP = 1;
|
12 |
+
const MAIL_TARNSPORT_TYPE_FILE = 2;
|
13 |
+
|
14 |
+
public function toOptionArray()
|
15 |
+
{
|
16 |
+
$helper = Mage::helper('alekseon_mailTransport');
|
17 |
+
$options = array(
|
18 |
+
self::MAIL_TARNSPORT_TYPE_DEFAULT => $helper->__('DEFAULT - PHP internal mail()'),
|
19 |
+
self::MAIL_TARNSPORT_TYPE_SMTP => $helper->__('SMTP - Simple Mail Transfer Protocol'),
|
20 |
+
self::MAIL_TARNSPORT_TYPE_FILE => $helper->__('File - Saves e-mail message to a file.'),
|
21 |
+
);
|
22 |
+
return $options;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/System/Config/Source/SmtpAuthModes.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_MailTransport_Model_System_Config_Source_SmtpAuthModes
|
9 |
+
{
|
10 |
+
const SMTP_AUTH_MODE_LOGIN = 'login';
|
11 |
+
const SMTP_AUTH_MODE_PLAIN = 'plain';
|
12 |
+
const SMTP_AUTH_MODE_CRAMMD5 = 'cramm5';
|
13 |
+
|
14 |
+
public function toOptionArray()
|
15 |
+
{
|
16 |
+
$helper = Mage::helper('alekseon_mailTransport');
|
17 |
+
$options = array(
|
18 |
+
self::SMTP_AUTH_MODE_LOGIN => $helper->__('Login'),
|
19 |
+
self::SMTP_AUTH_MODE_PLAIN => $helper->__('Plain'),
|
20 |
+
self::SMTP_AUTH_MODE_CRAMMD5 => $helper->__('Cram-md5'),
|
21 |
+
);
|
22 |
+
return $options;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/code/community/Alekseon/MailTransport/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<alekseon_mailTransport translate="title" module="alekseon_mailTransport">
|
20 |
+
<title>Mail Transport</title>
|
21 |
+
<sort_order>30</sort_order>
|
22 |
+
</alekseon_mailTransport>
|
23 |
+
</children>
|
24 |
+
</config>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</children>
|
28 |
+
</admin>
|
29 |
+
</resources>
|
30 |
+
</acl>
|
31 |
+
</config>
|
app/code/community/Alekseon/MailTransport/etc/config.xml
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
-
->
|
6 |
<modules>
|
7 |
<Alekseon_MailTransport>
|
8 |
<version>0.1.0</version>
|
9 |
</Alekseon_MailTransport>
|
10 |
</modules>
|
11 |
<global>
|
12 |
<models>
|
13 |
<alekseon_mailTransport>
|
14 |
<class>Alekseon_MailTransport_Model</class>
|
15 |
</alekseon_mailTransport>
|
16 |
<core>
|
17 |
<rewrite>
|
18 |
<email_template>Alekseon_MailTransport_Model_Email_Template</email_template>
|
19 |
</rewrite>
|
20 |
</core>
|
21 |
</models>
|
22 |
<helpers>
|
23 |
<alekseon_mailTransport>
|
24 |
<class>Alekseon_MailTransport_Helper</class>
|
25 |
</alekseon_mailTransport>
|
26 |
</helpers>
|
27 |
</global>
|
28 |
<default>
|
29 |
<alekseon_mailTransport>
|
30 |
<general>
|
31 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
32 |
</general>
|
33 |
</alekseon_mailTransport>
|
34 |
</default>
|
1 |
+
<?xml version="1.0"?>
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
|
|
7 |
<modules>
|
8 |
<Alekseon_MailTransport>
|
9 |
<version>0.1.0</version>
|
10 |
</Alekseon_MailTransport>
|
11 |
</modules>
|
12 |
<global>
|
13 |
<models>
|
14 |
<alekseon_mailTransport>
|
15 |
<class>Alekseon_MailTransport_Model</class>
|
16 |
</alekseon_mailTransport>
|
17 |
<core>
|
18 |
<rewrite>
|
19 |
<email_template>Alekseon_MailTransport_Model_Email_Template</email_template>
|
20 |
</rewrite>
|
21 |
</core>
|
22 |
</models>
|
23 |
<helpers>
|
24 |
<alekseon_mailTransport>
|
25 |
<class>Alekseon_MailTransport_Helper</class>
|
26 |
</alekseon_mailTransport>
|
27 |
</helpers>
|
28 |
</global>
|
29 |
<default>
|
30 |
<alekseon_mailTransport>
|
31 |
<general>
|
32 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
33 |
</general>
|
34 |
</alekseon_mailTransport>
|
35 |
</default>
|
app/code/community/Alekseon/MailTransport/etc/system.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<tabs>
|
12 |
+
<alekseon>
|
13 |
+
<label>Alekseon</label>
|
14 |
+
<sort_order>450</sort_order>
|
15 |
+
</alekseon>
|
16 |
+
</tabs>
|
17 |
+
<sections>
|
18 |
+
<alekseon_mailTransport translate="label" module="alekseon_mailTransport">
|
19 |
+
<label>Mail Transport</label>
|
20 |
+
<tab>alekseon</tab>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>30</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<groups>
|
27 |
+
<hint>
|
28 |
+
<frontend_model>alekseon_core/adminhtml_system_config_fieldset_alekseon</frontend_model>
|
29 |
+
<sort_order>0</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</hint>
|
34 |
+
<general translate="label" module="alekseon_mailTransport">
|
35 |
+
<label>General Settings</label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
<fields>
|
42 |
+
<type translate="label comment">
|
43 |
+
<label>Mail Transport Type</label>
|
44 |
+
<frontend_type>select</frontend_type>
|
45 |
+
<source_model>alekseon_mailTransport/system_config_source_mailTransportTypes</source_model>
|
46 |
+
<sort_order>10</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
<comment>Make sure that you don't use "File" type on live environment.</comment>
|
51 |
+
</type>
|
52 |
+
<smtp_host translate="label">
|
53 |
+
<label>Host</label>
|
54 |
+
<sort_order>20</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
<depends><type>1</type></depends>
|
59 |
+
</smtp_host>
|
60 |
+
<smtp_port translate="label">
|
61 |
+
<label>Port</label>
|
62 |
+
<sort_order>30</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
<depends><type>1</type></depends>
|
67 |
+
</smtp_port>
|
68 |
+
<smtp_ssl translate="label">
|
69 |
+
<label>Encryption protocol</label>
|
70 |
+
<frontend_type>select</frontend_type>
|
71 |
+
<source_model>alekseon_mailTransport/system_config_source_encryptionProtocols</source_model>
|
72 |
+
<sort_order>40</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>1</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
<depends><type>1</type></depends>
|
77 |
+
</smtp_ssl>
|
78 |
+
<smtp_auth translate="label">
|
79 |
+
<label>Authentication Mode</label>
|
80 |
+
<frontend_type>select</frontend_type>
|
81 |
+
<source_model>alekseon_mailTransport/system_config_source_smtpAuthModes</source_model>
|
82 |
+
<sort_order>50</sort_order>
|
83 |
+
<show_in_default>1</show_in_default>
|
84 |
+
<show_in_website>1</show_in_website>
|
85 |
+
<show_in_store>1</show_in_store>
|
86 |
+
<depends><type>1</type></depends>
|
87 |
+
</smtp_auth>
|
88 |
+
<smtp_user translate="label">
|
89 |
+
<label>User</label>
|
90 |
+
<sort_order>60</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
<depends><type>1</type></depends>
|
95 |
+
</smtp_user>
|
96 |
+
<smtp_password translate="label">
|
97 |
+
<label>Password</label>
|
98 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
99 |
+
<frontend_type>obscure</frontend_type>
|
100 |
+
<sort_order>70</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
<depends><type>1</type></depends>
|
105 |
+
</smtp_password>
|
106 |
+
<file_path translate="label comment">
|
107 |
+
<label>Path for directory</label>
|
108 |
+
<sort_order>80</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
<depends><type>2</type></depends>
|
113 |
+
<comment>For example: "var/mails". Make sure that path is correct and directory exists.</comment>
|
114 |
+
</file_path>
|
115 |
+
</fields>
|
116 |
+
</general>
|
117 |
+
</groups>
|
118 |
+
</alekseon_mailTransport>
|
119 |
+
</sections>
|
120 |
+
</config>
|
app/etc/modules/Alekseon_AdminNotification.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Alekseon_AdminNotification>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
<depends>
|
16 |
+
<Mage_AdminNotification />
|
17 |
+
<Alekseon_Core />
|
18 |
+
</depends>
|
19 |
+
</Alekseon_AdminNotification>
|
20 |
+
</modules>
|
21 |
+
</config>
|
app/etc/modules/Alekseon_MailTrasnport.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Alekseon_MailTransport>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Alekseon_MailTransport>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>mail_transport</name>
|
4 |
+
<version>0.1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Send magento emails by protocol SMTP or save them to a files.</summary>
|
10 |
+
<description>Send magento emails by protocol SMTP or save them to a files.</description>
|
11 |
+
<notes>Send magento emails by protocol SMTP or save them to a files.</notes>
|
12 |
+
<authors><author><name>Marcin Frymark</name><user>Alekseon</user><email>contact@alekseon.com</email></author></authors>
|
13 |
+
<date>2014-03-07</date>
|
14 |
+
<time>09:38:16</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Alekseon"><dir name="MailTransport"><dir><dir name="Helper"><file name="Data.php" hash="4205979868b86789b2704c134630736a"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="b30c24c2853bb06f8c0ec3b470ad6951"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="EncryptionProtocols.php" hash="71dfa161d404dc77be304c9946e7318e"/><file name="MailTransportTypes.php" hash="c60afbdae29ed7afbf016b6fef33f94c"/><file name="SmtpAuthModes.php" hash="6b30e126782cdc9bb93755c179c06fc4"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="68a57d2d88b48e9238eddef0e6659d18"/><file name="config.xml" hash="d8a0279d4d1cd9076f8804ff52b2e7ab"/><file name="system.xml" hash="e257acfd5e5ec006f3d603d627e2811a"/></dir></dir></dir><dir name="AdminNotification"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Notification.php" hash="0cf97c24e0e7497955ee17fb14daef52"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d82dbd74204aace87e9f28be31ba98e6"/></dir><dir name="Model"><file name="Feed.php" hash="d25c0486febfecd06567e9d487ffde11"/><file name="Observer.php" hash="0bc915784005f5424bfa4940bb496d05"/></dir><dir name="etc"><file name="adminhtml.xml" hash="b63f6dd92e49def5499f7560bc1fa15c"/><file name="config.xml" hash="0ed69e4e9d2dbcfbd2cc24d2f79faf46"/><file name="system.xml" hash="7211e39b5159acca15740dfd391f69af"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alekseon_MailTrasnport.xml" hash="e99dcf95b0657403cec683729a620450"/><file name="Alekseon_AdminNotification.xml" hash="9635261e9cedc0c69e49d20bcddfbc6e"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|