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.1.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.0.5 to 0.1.1.0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail.php +20 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/Grid.php +102 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/Grid/Renderer/Receipient.php +31 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/TopMessage.php +18 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View.php +26 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View/Form.php +124 -0
- app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View/MailBody.php +19 -0
- app/code/community/Alekseon/MailTransport/Helper/Data.php +5 -0
- app/code/community/Alekseon/MailTransport/Model/Email/Template.php +85 -1
- app/code/community/Alekseon/MailTransport/Model/Observer.php +31 -0
- app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail.php +15 -0
- app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Collection.php +34 -0
- app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Correspondent.php +15 -0
- app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Correspondent/Collection.php +14 -0
- app/code/community/Alekseon/MailTransport/Model/SentEmail.php +1 -0
- app/code/community/Alekseon/MailTransport/Model/SentEmail/Correspondent.php +1 -0
- app/code/community/Alekseon/MailTransport/Model/System/Config/Source/MailTransportTypes.php +14 -6
- app/code/community/Alekseon/MailTransport/controllers/Adminhtml/MailTransport/SentEmailsHistoryController.php +73 -0
- app/code/community/Alekseon/MailTransport/etc/adminhtml.xml +27 -0
- app/code/community/Alekseon/MailTransport/etc/config.xml +1 -3
- app/code/community/Alekseon/MailTransport/etc/system.xml +36 -1
- app/code/community/Alekseon/MailTransport/sql/alekseon_mailtransport_setup/mysql4-install-0.1.1.php +37 -0
- app/design/adminhtml/default/default/layout/alekseon/mailTransport.xml +28 -0
- app/design/adminhtml/default/default/template/alekseon/mailTransport/sentEmail/topMessage.phtml +7 -0
- app/design/adminhtml/default/default/template/alekseon/mailTransport/sentEmail/view/form.phtml +104 -0
- package.xml +4 -4
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail extends Mage_Adminhtml_Block_Widget_Grid_Container
|
9 |
+
{
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->_blockGroup = 'alekseon_mailTransport';
|
14 |
+
$this->_controller = 'adminhtml_sentEmail';
|
15 |
+
$this->_headerText = Mage::helper('alekseon_mailTransport')->__('Sent Emails History');
|
16 |
+
parent::__construct();
|
17 |
+
$this->removeButton('add');
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/Grid.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('sent_email_grid');
|
15 |
+
$this->setSaveParametersInSession(true);
|
16 |
+
$this->setUseAjax(true);
|
17 |
+
$this->setDefaultSort('sent_at');
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareColumns()
|
21 |
+
{
|
22 |
+
$this->addColumn('sent_at',
|
23 |
+
array(
|
24 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Sent At'),
|
25 |
+
'index' => 'sent_at',
|
26 |
+
'type' => 'datetime',
|
27 |
+
'width' => '100px',
|
28 |
+
)
|
29 |
+
);
|
30 |
+
|
31 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
32 |
+
$this->addColumn('store_id',
|
33 |
+
array(
|
34 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Sent From (Store)'),
|
35 |
+
'index' => 'store_id',
|
36 |
+
'type' => 'store',
|
37 |
+
'display_deleted' => true,
|
38 |
+
)
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
$this->addColumn('receipient',
|
43 |
+
array(
|
44 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Receipient'),
|
45 |
+
'index' => 'receipient',
|
46 |
+
'renderer' => 'alekseon_mailTransport/adminhtml_sentEmail_grid_renderer_receipient',
|
47 |
+
'sortable' => false,
|
48 |
+
)
|
49 |
+
);
|
50 |
+
|
51 |
+
$this->addColumn('subject',
|
52 |
+
array(
|
53 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Subject'),
|
54 |
+
'index' => 'subject',
|
55 |
+
)
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->addColumn('transport_type',
|
59 |
+
array(
|
60 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Transport Type'),
|
61 |
+
'index' => 'transport_type',
|
62 |
+
'type' => 'options',
|
63 |
+
'options' => Mage::getSingleton('alekseon_mailTransport/system_config_source_mailTransportTypes')->toOptionArray(true),
|
64 |
+
)
|
65 |
+
);
|
66 |
+
|
67 |
+
$this->addColumn('status',
|
68 |
+
array(
|
69 |
+
'header' => Mage::helper('alekseon_mailTransport')->__('Status'),
|
70 |
+
'index' => 'status',
|
71 |
+
'type' => 'options',
|
72 |
+
'options' => array(0 => $this->__('Failed'), 1 => $this->__('Success')),
|
73 |
+
'frame_callback' => array($this, 'decorateStatus')
|
74 |
+
)
|
75 |
+
);
|
76 |
+
|
77 |
+
return parent::_prepareColumns();
|
78 |
+
}
|
79 |
+
|
80 |
+
protected function _prepareCollection()
|
81 |
+
{
|
82 |
+
$collection = Mage::getModel('alekseon_mailTransport/sentEmail')->getCollection();
|
83 |
+
$this->setCollection($collection);
|
84 |
+
|
85 |
+
return parent::_prepareCollection();
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getRowUrl($item)
|
89 |
+
{
|
90 |
+
return Mage::getUrl('*/*/view', array('id' => $item->getId()));
|
91 |
+
}
|
92 |
+
|
93 |
+
public function decorateStatus($value, $row, $column, $isExport)
|
94 |
+
{
|
95 |
+
if ($row->getStatus()) {
|
96 |
+
$cell = '<span class="grid-severity-notice"><span>'.$value.'</span></span>';
|
97 |
+
} else {
|
98 |
+
$cell = '<span class="grid-severity-critical"><span>'.$value.'</span></span>';
|
99 |
+
}
|
100 |
+
return $cell;
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/Grid/Renderer/Receipient.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail_Grid_Renderer_Receipient extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
9 |
+
{
|
10 |
+
protected $_receipients;
|
11 |
+
|
12 |
+
public function render(Varien_Object $row)
|
13 |
+
{
|
14 |
+
if (is_null($this->_receipients)) {
|
15 |
+
$this->_receipients = array();
|
16 |
+
$sentMailsIds = $this->getColumn()->getGrid()->getCollection()->getAllIds();
|
17 |
+
$receipients = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent')
|
18 |
+
->getCollection()
|
19 |
+
->addFieldToFilter('type', Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT)
|
20 |
+
->addFieldToFilter('sentemail_id', array('in' => $sentMailsIds));
|
21 |
+
foreach($receipients as $receipient) {
|
22 |
+
$this->_receipients[$receipient->getSentemailId()][] = $receipient->getName() . ' <' . $receipient->getEmail() . '>';
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if (isset($this->_receipients[$row->getId()])) {
|
27 |
+
return implode('<br/>', $this->_receipients[$row->getId()]);
|
28 |
+
}
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/TopMessage.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_MailTransport_Block_Adminhtml_SentEmail_TopMessage extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function canDisplay()
|
11 |
+
{
|
12 |
+
if (Mage::helper('alekseon_mailTransport')->isSentEmailHistoryEnabled()) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_mode = 'view';
|
13 |
+
$this->_blockGroup = 'alekseon_mailTransport';
|
14 |
+
$this->_controller = 'adminhtml_sentEmail';
|
15 |
+
|
16 |
+
parent::__construct();
|
17 |
+
|
18 |
+
$this->_removeButton('save');
|
19 |
+
$this->_removeButton('reset');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getHeaderText()
|
23 |
+
{
|
24 |
+
return Mage::helper('alekseon_mailTransport')->__('Sent Email');
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View/Form.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail_View_Form extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
protected $_correspondents = array();
|
11 |
+
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->setTemplate('alekseon/mailTransport/sentEmail/view/form.phtml');
|
16 |
+
$this->_prepareCorrespondents();
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareCorrespondents()
|
20 |
+
{
|
21 |
+
foreach($this->getEmail()->getCorrespondents() as $correspondent) {
|
22 |
+
$this->_correspondents[$correspondent->getType()][] = $correspondent;
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getEmail()
|
28 |
+
{
|
29 |
+
return Mage::registry('current_sentEmail');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getSubject()
|
33 |
+
{
|
34 |
+
return $this->getEmail()->getSubject();
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getMailBodyIframeUrl()
|
38 |
+
{
|
39 |
+
return $this->getUrl('*/*/mailBody', array('id' => $this->getEmail()->getId()));
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getSentAt()
|
43 |
+
{
|
44 |
+
return $this->formatDate($this->getEmail()->getSentAt(), 'medium', true);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getStatus()
|
48 |
+
{
|
49 |
+
return $this->getEmail()->getStatus();
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getComment()
|
53 |
+
{
|
54 |
+
return $this->getEmail()->getComment();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getSentFrom()
|
58 |
+
{
|
59 |
+
$storeId = $this->getEmail()->getStoreId();
|
60 |
+
$store = Mage::app()->getStore($storeId);
|
61 |
+
$name = array(
|
62 |
+
$store->getWebsite()->getName(),
|
63 |
+
$store->getGroup()->getName(),
|
64 |
+
$store->getName()
|
65 |
+
);
|
66 |
+
return implode('<br/>', $name);
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getTransportType()
|
70 |
+
{
|
71 |
+
$transportType = $this->getEmail()->getTransportType();
|
72 |
+
$trasnportTypes = Mage::getSingleton('alekseon_mailTransport/system_config_source_mailTransportTypes')->toOptionArray();
|
73 |
+
if (isset($trasnportTypes[$transportType])) {
|
74 |
+
return $trasnportTypes[$transportType];
|
75 |
+
} else {
|
76 |
+
return Mage::helper('alekseon_mailTransport')->__('Unknown');
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getUsedTemplate()
|
81 |
+
{
|
82 |
+
$templateId = $this->getEmail()->getTemplateId();
|
83 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
84 |
+
|
85 |
+
if (is_numeric($templateId)) {
|
86 |
+
$mailTemplate->load($templateId);
|
87 |
+
if ($mailTemplate->getId()) {
|
88 |
+
return Mage::helper('alekseon_mailTransport')->__('Transactional Email Template') . ':<br/>' . $mailTemplate->getTemplateCode();
|
89 |
+
}
|
90 |
+
} else {
|
91 |
+
$defaultTemplates = $mailTemplate->getDefaultTemplates();
|
92 |
+
if (isset($defaultTemplates[$templateId])) {
|
93 |
+
$data = &$defaultTemplates[$templateId];
|
94 |
+
return Mage::helper('alekseon_mailTransport')->__('Default Template') . ':<br/>' . $templateId . '<br/>' . Mage::helper('alekseon_mailTransport')->__('File') . ': ' . $data['file'];
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
return $templateId;
|
99 |
+
}
|
100 |
+
|
101 |
+
public function getSender()
|
102 |
+
{
|
103 |
+
if (isset($this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_SENDER])) {
|
104 |
+
return $this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_SENDER];
|
105 |
+
}
|
106 |
+
return array();
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getReceipients()
|
110 |
+
{
|
111 |
+
if (isset($this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT])) {
|
112 |
+
return $this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT];
|
113 |
+
}
|
114 |
+
return array();
|
115 |
+
}
|
116 |
+
|
117 |
+
public function getBccReceipients()
|
118 |
+
{
|
119 |
+
if (isset($this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_BCC])) {
|
120 |
+
return $this->_correspondents[Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_BCC];
|
121 |
+
}
|
122 |
+
return array();
|
123 |
+
}
|
124 |
+
}
|
app/code/community/Alekseon/MailTransport/Block/Adminhtml/SentEmail/View/MailBody.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Block_Adminhtml_SentEmail_View_MailBody extends Mage_Adminhtml_Block_Abstract
|
9 |
+
{
|
10 |
+
public function getEmail()
|
11 |
+
{
|
12 |
+
return Mage::registry('current_sentEmail');
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _toHtml()
|
16 |
+
{
|
17 |
+
return $this->getEmail()->getMailBody();
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Alekseon/MailTransport/Helper/Data.php
CHANGED
@@ -11,4 +11,9 @@ class Alekseon_MailTransport_Helper_Data extends Mage_Core_Helper_Abstract
|
|
11 |
{
|
12 |
return 'http://www.alekseon.com';
|
13 |
}
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
11 |
{
|
12 |
return 'http://www.alekseon.com';
|
13 |
}
|
14 |
+
|
15 |
+
public function isSentEmailHistoryEnabled()
|
16 |
+
{
|
17 |
+
return Mage::getStoreConfig('alekseon_mailTransport/sent_email_history/enabled');
|
18 |
+
}
|
19 |
}
|
app/code/community/Alekseon/MailTransport/Model/Email/Template.php
CHANGED
@@ -7,6 +7,22 @@
|
|
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);
|
@@ -28,6 +44,11 @@ class Alekseon_MailTransport_Model_Email_Template extends Mage_Core_Model_Email_
|
|
28 |
{
|
29 |
$transport = null;
|
30 |
$transportType = $this->getMailTransportConfig('type', $storeId);
|
|
|
|
|
|
|
|
|
|
|
31 |
switch($transportType) {
|
32 |
case Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_SMTP:
|
33 |
$transport = $this->_getSmtpTransport($storeId);
|
@@ -36,6 +57,8 @@ class Alekseon_MailTransport_Model_Email_Template extends Mage_Core_Model_Email_
|
|
36 |
$transport= $this->_getFileTranport($storeId);
|
37 |
break;
|
38 |
}
|
|
|
|
|
39 |
|
40 |
return $transport;
|
41 |
}
|
@@ -76,12 +99,73 @@ class Alekseon_MailTransport_Model_Email_Template extends Mage_Core_Model_Email_
|
|
76 |
return $transport;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
public function send($email, $name = null, array $variables = array())
|
80 |
{
|
81 |
if (isset($variables['store'])) {
|
82 |
$store = $variables['store'];
|
83 |
$this->getMail($store->getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
-
return parent::
|
86 |
}
|
87 |
}
|
7 |
*/
|
8 |
class Alekseon_MailTransport_Model_Email_Template extends Mage_Core_Model_Email_Template
|
9 |
{
|
10 |
+
protected $_sentEmailModel;
|
11 |
+
|
12 |
+
public function getProcessedTemplate(array $variables = array())
|
13 |
+
{
|
14 |
+
$processedResult = parent::getProcessedTemplate($variables);
|
15 |
+
$this->getSentEmailModel()->setMailBody($processedResult);
|
16 |
+
return $processedResult;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getProcessedTemplateSubject(array $variables)
|
20 |
+
{
|
21 |
+
$processedResult = parent::getProcessedTemplateSubject($variables);
|
22 |
+
$this->getSentEmailModel()->setSubject($processedResult);
|
23 |
+
return $processedResult;
|
24 |
+
}
|
25 |
+
|
26 |
public function getMailTransportConfig($configField, $storeId)
|
27 |
{
|
28 |
return Mage::getStoreConfig('alekseon_mailTransport/general/' . $configField, $storeId);
|
44 |
{
|
45 |
$transport = null;
|
46 |
$transportType = $this->getMailTransportConfig('type', $storeId);
|
47 |
+
|
48 |
+
if (!$transportType) {
|
49 |
+
$transportType = Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_DEFAULT;
|
50 |
+
}
|
51 |
+
|
52 |
switch($transportType) {
|
53 |
case Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_SMTP:
|
54 |
$transport = $this->_getSmtpTransport($storeId);
|
57 |
$transport= $this->_getFileTranport($storeId);
|
58 |
break;
|
59 |
}
|
60 |
+
|
61 |
+
$this->getSentEmailModel()->setTransportType($transportType);
|
62 |
|
63 |
return $transport;
|
64 |
}
|
99 |
return $transport;
|
100 |
}
|
101 |
|
102 |
+
public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
|
103 |
+
{
|
104 |
+
$this->getSentEmailModel()->setTemplateId($templateId);
|
105 |
+
$this->getSentEmailModel()->addSender($sender, $storeId);
|
106 |
+
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
107 |
+
}
|
108 |
+
|
109 |
public function send($email, $name = null, array $variables = array())
|
110 |
{
|
111 |
if (isset($variables['store'])) {
|
112 |
$store = $variables['store'];
|
113 |
$this->getMail($store->getId());
|
114 |
+
$this->getSentEmailModel()->setStoreId($store->getId());
|
115 |
+
}
|
116 |
+
|
117 |
+
try {
|
118 |
+
$result = parent::send($email, $name, $variables);
|
119 |
+
$this->_saveSentEmail($email, $name, $result);
|
120 |
+
} catch (Exception $e) {
|
121 |
+
$this->_saveSentEmail($email, $name, false);
|
122 |
+
Mage::trowException($e);
|
123 |
+
}
|
124 |
+
|
125 |
+
return $result;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function getSentEmailModel()
|
129 |
+
{
|
130 |
+
if (is_null($this->_sentEmailModel)) {
|
131 |
+
$this->_sentEmailModel = Mage::getModel('alekseon_mailTransport/sentEmail');
|
132 |
+
}
|
133 |
+
return $this->_sentEmailModel;
|
134 |
+
}
|
135 |
+
|
136 |
+
protected function _saveSentEmail($email, $name, $result)
|
137 |
+
{
|
138 |
+
if (!Mage::helper('alekseon_mailTransport')->isSentEmailHistoryEnabled()) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$emails = array_values((array)$email);
|
143 |
+
$names = is_array($name) ? $name : (array)$name;
|
144 |
+
$names = array_values($names);
|
145 |
+
|
146 |
+
try {
|
147 |
+
foreach ($emails as $key => $email) {
|
148 |
+
$name = isset($names[$key]) ? $names[$key] : null;
|
149 |
+
$this->getSentEmailModel()->addReceipient($email, $name);
|
150 |
+
}
|
151 |
+
$this->getSentEmailModel()->setSentAt(Mage::getSingleton('core/date')->gmtDate());
|
152 |
+
$this->getSentEmailModel()->setStatus($result);
|
153 |
+
$this->getSentEmailModel()->save();
|
154 |
+
$this->getSentEmailModel()->unsetData();
|
155 |
+
} catch (Exception $e) {
|
156 |
+
Mage::logException($e);
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
public function addBcc($bcc)
|
161 |
+
{
|
162 |
+
if (is_array($bcc)) {
|
163 |
+
foreach ($bcc as $email) {
|
164 |
+
$this->getSentEmailModel()->addBccReceipient($email);
|
165 |
+
}
|
166 |
+
} elseif ($bcc) {
|
167 |
+
$this->getSentEmailModel()->addBccReceipient($bcc);
|
168 |
}
|
169 |
+
return parent::addBcc($bcc);
|
170 |
}
|
171 |
}
|
app/code/community/Alekseon/MailTransport/Model/Observer.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Observer
|
9 |
+
{
|
10 |
+
public function removeOldSentEmails()
|
11 |
+
{
|
12 |
+
$sentEmails = Mage::getModel('alekseon_mailTransport/sentEmail')->getCollection();
|
13 |
+
foreach($sentEmails as $sentEmail) {
|
14 |
+
$sentAt = $sentEmail->getSentAt();
|
15 |
+
$now = Mage::getModel('core/date')->gmtDate();
|
16 |
+
$sentAtTime = strtotime($sentAt);
|
17 |
+
$nowTime = strtotime($now);
|
18 |
+
$daysDifference = floor(($nowTime - $sentAtTime) / (60 * 60 * 24));
|
19 |
+
|
20 |
+
if ($sentEmail->getStatus()) {
|
21 |
+
$deleteAfter = Mage::getStoreConfig('alekseon_mailTransport/sent_email_history/remove_successed_after');
|
22 |
+
} else {
|
23 |
+
$deleteAfter = Mage::getStoreConfig('alekseon_mailTransport/sent_email_history/remove_failed_after');
|
24 |
+
}
|
25 |
+
|
26 |
+
if (is_numeric($deleteAfter) && $deleteAfter <= $daysDifference) {
|
27 |
+
$sentEmail->delete();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Resource_SentEmail extends Mage_Core_Model_Resource_Db_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_mailTransport/sentemail', 'id');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Resource_SentEmail_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_mailTransport/sentEmail');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function addFieldToFilter($field, $condition = null)
|
16 |
+
{
|
17 |
+
if ($field == 'receipient') {
|
18 |
+
$correspondents = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent')
|
19 |
+
->getCollection()
|
20 |
+
->addFieldToFilter('type', Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT)
|
21 |
+
->addFieldToFilter(array('name', 'email'), array($condition, $condition));
|
22 |
+
|
23 |
+
$sentEmailsIds = array();
|
24 |
+
foreach($correspondents as $correspondent) {
|
25 |
+
$sentEmailsIds[] = $correspondent->getSentemailId();
|
26 |
+
}
|
27 |
+
|
28 |
+
$field = $this->getResource()->getIdFieldName();
|
29 |
+
$condition = array('in' => $sentEmailsIds);
|
30 |
+
}
|
31 |
+
|
32 |
+
return parent::addFieldToFilter($field, $condition);
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Correspondent.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Resource_SentEmail_Correspondent extends Mage_Core_Model_Resource_Db_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_mailTransport/sentemail_correspondent', 'id');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/Resource/SentEmail/Correspondent/Collection.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Resource_SentEmail_Correspondent_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_mailTransport/sentEmail_correspondent');
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Alekseon/MailTransport/Model/SentEmail.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
protected $_correspondents;
|
6 |
public function __construct($args = array())
|
7 |
{
|
8 |
}
|
9 |
|
10 |
public function unsetData($key = null)
|
11 |
{
|
12 |
$this->_correspondents = null;
|
13 |
return parent::unsetData($key);
|
14 |
}
|
15 |
public function addReceipient($email, $name = null)
|
16 |
{
|
17 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT, $email, $name);
|
18 |
}
|
19 |
|
20 |
public function addBccReceipient($email, $name = null)
|
21 |
{
|
22 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_BCC, $email, $name);
|
23 |
}
|
24 |
|
25 |
public function addSender($sender, $storeId)
|
26 |
{
|
27 |
if (!is_array($sender)) {
|
28 |
$name = Mage::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId);
|
29 |
$email = Mage::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId);
|
30 |
} else {
|
31 |
$name = $sender['name'];
|
32 |
$email = $sender['email'];
|
33 |
}
|
34 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_SENDER, $email, $name);
|
35 |
}
|
36 |
|
37 |
public function getCorrespondents()
|
38 |
{
|
39 |
if (is_null($this->_correspondents)) {
|
40 |
$this->_correspondents = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent')
|
41 |
->getCollection()
|
42 |
->addFieldToFilter('sentemail_id', $this->getId());
|
43 |
}
|
44 |
|
45 |
return $this->_correspondents;
|
46 |
}
|
47 |
|
48 |
protected function _afterSave()
|
49 |
{
|
50 |
if (null !== $this->getCorrespondents()) {
|
51 |
foreach($this->getCorrespondents() as $correspondent) {
|
52 |
if (!$correspondent->getId()) {
|
53 |
$correspondent->setSentemailId($this->getId());
|
54 |
$correspondent->save();
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
return parent::_afterSave();
|
59 |
}
|
60 |
|
61 |
protected function _addCorrespondent($type, $email, $name = null)
|
62 |
{
|
63 |
if (is_null($name)) {
|
64 |
$name = substr($email, 0, strpos($email, '@'));
|
65 |
}
|
66 |
$correspondent = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent');
|
67 |
$correspondent->setType($type);
|
68 |
$correspondent->setName($name);
|
69 |
$correspondent->setEmail($email);
|
70 |
$this->getCorrespondents()->addItem($correspondent);
|
71 |
return $correspondent;
|
72 |
}
|
1 |
+
<?php
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
7 |
protected $_correspondents;
|
8 |
public function __construct($args = array())
|
9 |
{
|
10 |
}
|
11 |
|
12 |
public function unsetData($key = null)
|
13 |
{
|
14 |
$this->_correspondents = null;
|
15 |
return parent::unsetData($key);
|
16 |
}
|
17 |
public function addReceipient($email, $name = null)
|
18 |
{
|
19 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT, $email, $name);
|
20 |
}
|
21 |
|
22 |
public function addBccReceipient($email, $name = null)
|
23 |
{
|
24 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_BCC, $email, $name);
|
25 |
}
|
26 |
|
27 |
public function addSender($sender, $storeId)
|
28 |
{
|
29 |
if (!is_array($sender)) {
|
30 |
$name = Mage::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId);
|
31 |
$email = Mage::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId);
|
32 |
} else {
|
33 |
$name = $sender['name'];
|
34 |
$email = $sender['email'];
|
35 |
}
|
36 |
return $this->_addCorrespondent(Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_SENDER, $email, $name);
|
37 |
}
|
38 |
|
39 |
public function getCorrespondents()
|
40 |
{
|
41 |
if (is_null($this->_correspondents)) {
|
42 |
$this->_correspondents = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent')
|
43 |
->getCollection()
|
44 |
->addFieldToFilter('sentemail_id', $this->getId());
|
45 |
}
|
46 |
|
47 |
return $this->_correspondents;
|
48 |
}
|
49 |
|
50 |
protected function _afterSave()
|
51 |
{
|
52 |
if (null !== $this->getCorrespondents()) {
|
53 |
foreach($this->getCorrespondents() as $correspondent) {
|
54 |
if (!$correspondent->getId()) {
|
55 |
$correspondent->setSentemailId($this->getId());
|
56 |
$correspondent->save();
|
57 |
}
|
58 |
}
|
59 |
}
|
60 |
return parent::_afterSave();
|
61 |
}
|
62 |
|
63 |
protected function _addCorrespondent($type, $email, $name = null)
|
64 |
{
|
65 |
if (is_null($name)) {
|
66 |
$name = substr($email, 0, strpos($email, '@'));
|
67 |
}
|
68 |
$correspondent = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent');
|
69 |
$correspondent->setType($type);
|
70 |
$correspondent->setName($name);
|
71 |
$correspondent->setEmail($email);
|
72 |
$this->getCorrespondents()->addItem($correspondent);
|
73 |
return $correspondent;
|
74 |
}
|
app/code/community/Alekseon/MailTransport/Model/SentEmail/Correspondent.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
const TYPE_RECEIPIENT = 'RECEIPIENT';
|
6 |
const TYPE_BCC = 'BCC_RECEIPIENT';
|
7 |
const TYPE_SENDER = 'SENDER';
|
8 |
public function __construct($args = array())
|
9 |
{
|
10 |
}
|
1 |
+
<?php
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
7 |
const TYPE_RECEIPIENT = 'RECEIPIENT';
|
8 |
const TYPE_BCC = 'BCC_RECEIPIENT';
|
9 |
const TYPE_SENDER = 'SENDER';
|
10 |
public function __construct($args = array())
|
11 |
{
|
12 |
}
|
app/code/community/Alekseon/MailTransport/Model/System/Config/Source/MailTransportTypes.php
CHANGED
@@ -11,14 +11,22 @@ class Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes
|
|
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 |
-
$
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
return $options;
|
23 |
}
|
24 |
|
11 |
const MAIL_TARNSPORT_TYPE_SMTP = 1;
|
12 |
const MAIL_TARNSPORT_TYPE_FILE = 2;
|
13 |
|
14 |
+
public function toOptionArray($short = false)
|
15 |
{
|
16 |
$helper = Mage::helper('alekseon_mailTransport');
|
17 |
+
if ($short) {
|
18 |
+
$options = array(
|
19 |
+
self::MAIL_TARNSPORT_TYPE_DEFAULT => $helper->__('PHP'),
|
20 |
+
self::MAIL_TARNSPORT_TYPE_SMTP => $helper->__('SMTP'),
|
21 |
+
self::MAIL_TARNSPORT_TYPE_FILE => $helper->__('File'),
|
22 |
+
);
|
23 |
+
} else {
|
24 |
+
$options = array(
|
25 |
+
self::MAIL_TARNSPORT_TYPE_DEFAULT => $helper->__('PHP - PHP internal mail()'),
|
26 |
+
self::MAIL_TARNSPORT_TYPE_SMTP => $helper->__('SMTP - Simple Mail Transfer Protocol'),
|
27 |
+
self::MAIL_TARNSPORT_TYPE_FILE => $helper->__('File - Saves e-mail message to a file.'),
|
28 |
+
);
|
29 |
+
}
|
30 |
return $options;
|
31 |
}
|
32 |
|
app/code/community/Alekseon/MailTransport/controllers/Adminhtml/MailTransport/SentEmailsHistoryController.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Adminhtml_MailTransport_SentEmailsHistoryController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
public function _initSentEmail()
|
11 |
+
{
|
12 |
+
$sentEmailId = (int) $this->getRequest()->getParam('id');
|
13 |
+
$sentEmail = Mage::getModel('alekseon_mailTransport/sentEmail');
|
14 |
+
|
15 |
+
if ($sentEmailId) {
|
16 |
+
$sentEmail->load($sentEmailId);
|
17 |
+
}
|
18 |
+
|
19 |
+
Mage::register('current_sentEmail', $sentEmail);
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function indexAction()
|
24 |
+
{
|
25 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
26 |
+
$this->_forward('grid');
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->renderLayout();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function gridAction()
|
35 |
+
{
|
36 |
+
$this->loadLayout();
|
37 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('alekseon_mailTransport/adminhtml_sentEmail_grid')->toHtml());
|
38 |
+
}
|
39 |
+
|
40 |
+
public function viewAction()
|
41 |
+
{
|
42 |
+
$this->_initSentEmail();
|
43 |
+
$this->loadLayout();
|
44 |
+
$this->renderLayout();
|
45 |
+
}
|
46 |
+
|
47 |
+
public function deleteAction()
|
48 |
+
{
|
49 |
+
$this->_initSentEmail();
|
50 |
+
$sentEmail = Mage::registry('current_sentEmail');
|
51 |
+
|
52 |
+
try {
|
53 |
+
$sentEmail->delete();
|
54 |
+
} catch (Exception $e) {
|
55 |
+
$this->_getSession()->addError($e->getMessage());
|
56 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/view', array('id' => $sentEmail->getId())));
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->_getSession()->addSuccess(
|
61 |
+
Mage::helper('alekseon_mailTransport')->__('Email has been removed.')
|
62 |
+
);
|
63 |
+
|
64 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/index'));
|
65 |
+
}
|
66 |
+
|
67 |
+
public function mailBodyAction()
|
68 |
+
{
|
69 |
+
$this->_initSentEmail();
|
70 |
+
$this->loadLayout();
|
71 |
+
$this->renderLayout();
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Alekseon/MailTransport/etc/adminhtml.xml
CHANGED
@@ -8,6 +8,23 @@
|
|
8 |
*/
|
9 |
-->
|
10 |
<config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
<acl>
|
12 |
<resources>
|
13 |
<admin>
|
@@ -26,6 +43,16 @@
|
|
26 |
</alekseon_mailTransport>
|
27 |
</children>
|
28 |
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
</children>
|
30 |
</system>
|
31 |
</children>
|
8 |
*/
|
9 |
-->
|
10 |
<config>
|
11 |
+
<menu>
|
12 |
+
<system>
|
13 |
+
<children>
|
14 |
+
<alekseon_tools translate="title" module="alekseon_mailTransport">
|
15 |
+
<title>Alekseon Tools</title>
|
16 |
+
<sort_order>89</sort_order>
|
17 |
+
<children>
|
18 |
+
<sent_emails_history>
|
19 |
+
<title>Sent Emails History</title>
|
20 |
+
<sort_order>20</sort_order>
|
21 |
+
<action>adminhtml/mailTransport_sentEmailsHistory</action>
|
22 |
+
</sent_emails_history>
|
23 |
+
</children>
|
24 |
+
</alekseon_tools>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</menu>
|
28 |
<acl>
|
29 |
<resources>
|
30 |
<admin>
|
43 |
</alekseon_mailTransport>
|
44 |
</children>
|
45 |
</config>
|
46 |
+
<alekseon_tools translate="title" module="alekseon_mailTransport">
|
47 |
+
<title>Alekseon Tools</title>
|
48 |
+
<sort_order>89</sort_order>
|
49 |
+
<children>
|
50 |
+
<sent_emails_history>
|
51 |
+
<title>Sent Emails History</title>
|
52 |
+
<sort_order>20</sort_order>
|
53 |
+
</sent_emails_history>
|
54 |
+
</children>
|
55 |
+
</alekseon_tools>
|
56 |
</children>
|
57 |
</system>
|
58 |
</children>
|
app/code/community/Alekseon/MailTransport/etc/config.xml
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
7 |
-
->
|
8 |
<modules>
|
9 |
<Alekseon_MailTransport>
|
10 |
<version>0.1.0</version>
|
11 |
</Alekseon_MailTransport>
|
12 |
</modules>
|
13 |
<global>
|
14 |
<models>
|
15 |
<alekseon_mailTransport>
|
16 |
<class>Alekseon_MailTransport_Model</class>
|
17 |
</alekseon_mailTransport>
|
18 |
<core>
|
19 |
<rewrite>
|
20 |
<email_template>Alekseon_MailTransport_Model_Email_Template</email_template>
|
21 |
</rewrite>
|
22 |
</core>
|
23 |
</models>
|
24 |
<blocks>
|
25 |
<alekseon_mailTransport>
|
26 |
<class>Alekseon_MailTransport_Block</class>
|
27 |
</alekseon_mailTransport>
|
28 |
</blocks>
|
29 |
<helpers>
|
30 |
<alekseon_mailTransport>
|
31 |
<class>Alekseon_MailTransport_Helper</class>
|
32 |
</alekseon_mailTransport>
|
33 |
</helpers>
|
34 |
</global>
|
35 |
<adminhtml>
|
36 |
<events>
|
37 |
<controller_action_predispatch>
|
38 |
<observers>
|
39 |
<alekseon_adminNotification>
|
40 |
<class>alekseon_mailTransport/alekseonAdminNotification_observer</class>
|
41 |
<method>preDispatch</method>
|
42 |
</alekseon_adminNotification>
|
43 |
</observers>
|
44 |
</controller_action_predispatch>
|
45 |
</events>
|
46 |
</adminhtml>
|
47 |
<default>
|
48 |
<alekseon_adminNotification>
|
49 |
<general>
|
50 |
<enabled>1</enabled>
|
51 |
<frequency>12</frequency>
|
52 |
</general>
|
53 |
</alekseon_adminNotification>
|
54 |
<alekseon_mailTransport>
|
55 |
<general>
|
56 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
57 |
</general>
|
58 |
</alekseon_mailTransport>
|
59 |
</default>
|
|
|
60 |
* @author Marcin Frymark
|
61 |
* @email contact@alekseon.com
|
62 |
* @company Alekseon
|
63 |
* @website www.alekseon.com
|
64 |
*/
|
65 |
-
->
|
66 |
<modules>
|
67 |
<Alekseon_MailTransport>
|
68 |
<version>0.1.1</version>
|
69 |
</Alekseon_MailTransport>
|
70 |
</modules>
|
71 |
<global>
|
72 |
<models>
|
73 |
<alekseon_mailTransport>
|
74 |
<class>Alekseon_MailTransport_Model</class>
|
75 |
<resourceModel>alekseon_mailtransport_resource</resourceModel>
|
76 |
</alekseon_mailTransport>
|
77 |
<alekseon_mailtransport_resource>
|
78 |
<class>Alekseon_MailTransport_Model_Resource</class>
|
79 |
<sentemail>
|
80 |
<table>alekseon_mailtransport_sentemail</table>
|
81 |
</sentemail>
|
82 |
<sentemail_correspondent>
|
83 |
<table>alekseon_mailtransport_sentemail_correspondent</table>
|
84 |
</sentemail_correspondent>
|
85 |
</entities>
|
86 |
</alekseon_mailtransport_resource>
|
87 |
<core>
|
88 |
<rewrite>
|
89 |
<email_template>Alekseon_MailTransport_Model_Email_Template</email_template>
|
90 |
</rewrite>
|
91 |
</core>
|
92 |
</models>
|
93 |
<blocks>
|
94 |
<alekseon_mailTransport>
|
95 |
<class>Alekseon_MailTransport_Block</class>
|
96 |
</alekseon_mailTransport>
|
97 |
</blocks>
|
98 |
<helpers>
|
99 |
<alekseon_mailTransport>
|
100 |
<class>Alekseon_MailTransport_Helper</class>
|
101 |
</alekseon_mailTransport>
|
102 |
</helpers>
|
103 |
<resources>
|
104 |
<alekseon_mailtransport_setup>
|
105 |
<setup>
|
106 |
<module>Alekseon_MailTransport</module>
|
107 |
<class>Mage_Core_Model_Resource_Setup</class>
|
108 |
</setup>
|
109 |
</alekseon_mailtransport_setup>
|
110 |
</resources>
|
111 |
</global>
|
112 |
<adminhtml>
|
113 |
<layout>
|
114 |
<updates>
|
115 |
<alekseon_mailTransport>
|
116 |
<file>alekseon/mailTransport.xml</file>
|
117 |
</alekseon_mailTransport>
|
118 |
</updates>
|
119 |
</layout>
|
120 |
<events>
|
121 |
<controller_action_predispatch>
|
122 |
<observers>
|
123 |
<alekseon_adminNotification>
|
124 |
<class>alekseon_mailTransport/alekseonAdminNotification_observer</class>
|
125 |
<method>preDispatch</method>
|
126 |
</alekseon_adminNotification>
|
127 |
</observers>
|
128 |
</controller_action_predispatch>
|
129 |
</events>
|
130 |
</adminhtml>
|
131 |
<admin>
|
132 |
<routers>
|
133 |
<adminhtml>
|
134 |
<args>
|
135 |
<modules>
|
136 |
<alekseon_mailTransport before="Mage_Adminhtml">Alekseon_MailTransport_Adminhtml</alekseon_mailTransport>
|
137 |
</modules>
|
138 |
</args>
|
139 |
</adminhtml>
|
140 |
</routers>
|
141 |
</admin>
|
142 |
<crontab>
|
143 |
<jobs>
|
144 |
<alekseon_remove_old_sent_emails>
|
145 |
<schedule>
|
146 |
<cron_expr>*/5 * * * *</cron_expr>
|
147 |
</schedule>
|
148 |
<run>
|
149 |
<model>alekseon_mailTransport/observer::removeOldSentEmails</model>
|
150 |
</run>
|
151 |
</alekseon_remove_old_sent_emails>
|
152 |
</jobs>
|
153 |
</crontab>
|
154 |
<default>
|
155 |
<alekseon_adminNotification>
|
156 |
<general>
|
157 |
<enabled>1</enabled>
|
158 |
<frequency>12</frequency>
|
159 |
</general>
|
160 |
</alekseon_adminNotification>
|
161 |
<alekseon_mailTransport>
|
162 |
<general>
|
163 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
164 |
</general>
|
165 |
<sent_email_history>
|
166 |
<remove_successed_after>30</remove_successed_after>
|
167 |
<remove_failed_after>30</remove_failed_after>
|
168 |
</sent_email_history>
|
169 |
</alekseon_mailTransport>
|
170 |
</default>
|
|
|
1 |
* @author Marcin Frymark
|
2 |
* @email contact@alekseon.com
|
3 |
* @company Alekseon
|
4 |
* @website www.alekseon.com
|
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 |
<blocks>
|
23 |
<alekseon_mailTransport>
|
24 |
<class>Alekseon_MailTransport_Block</class>
|
25 |
</alekseon_mailTransport>
|
26 |
</blocks>
|
27 |
<helpers>
|
28 |
<alekseon_mailTransport>
|
29 |
<class>Alekseon_MailTransport_Helper</class>
|
30 |
</alekseon_mailTransport>
|
31 |
</helpers>
|
32 |
</global>
|
33 |
<adminhtml>
|
34 |
<events>
|
35 |
<controller_action_predispatch>
|
36 |
<observers>
|
37 |
<alekseon_adminNotification>
|
38 |
<class>alekseon_mailTransport/alekseonAdminNotification_observer</class>
|
39 |
<method>preDispatch</method>
|
40 |
</alekseon_adminNotification>
|
41 |
</observers>
|
42 |
</controller_action_predispatch>
|
43 |
</events>
|
44 |
</adminhtml>
|
45 |
<default>
|
46 |
<alekseon_adminNotification>
|
47 |
<general>
|
48 |
<enabled>1</enabled>
|
49 |
<frequency>12</frequency>
|
50 |
</general>
|
51 |
</alekseon_adminNotification>
|
52 |
<alekseon_mailTransport>
|
53 |
<general>
|
54 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
55 |
</general>
|
56 |
</alekseon_mailTransport>
|
57 |
</default>
|
58 |
+
<?xml version="1.0"?>
|
59 |
* @author Marcin Frymark
|
60 |
* @email contact@alekseon.com
|
61 |
* @company Alekseon
|
62 |
* @website www.alekseon.com
|
63 |
*/
|
|
|
64 |
<modules>
|
65 |
<Alekseon_MailTransport>
|
66 |
<version>0.1.1</version>
|
67 |
</Alekseon_MailTransport>
|
68 |
</modules>
|
69 |
<global>
|
70 |
<models>
|
71 |
<alekseon_mailTransport>
|
72 |
<class>Alekseon_MailTransport_Model</class>
|
73 |
<resourceModel>alekseon_mailtransport_resource</resourceModel>
|
74 |
</alekseon_mailTransport>
|
75 |
<alekseon_mailtransport_resource>
|
76 |
<class>Alekseon_MailTransport_Model_Resource</class>
|
77 |
<sentemail>
|
78 |
<table>alekseon_mailtransport_sentemail</table>
|
79 |
</sentemail>
|
80 |
<sentemail_correspondent>
|
81 |
<table>alekseon_mailtransport_sentemail_correspondent</table>
|
82 |
</sentemail_correspondent>
|
83 |
</entities>
|
84 |
</alekseon_mailtransport_resource>
|
85 |
<core>
|
86 |
<rewrite>
|
87 |
<email_template>Alekseon_MailTransport_Model_Email_Template</email_template>
|
88 |
</rewrite>
|
89 |
</core>
|
90 |
</models>
|
91 |
<blocks>
|
92 |
<alekseon_mailTransport>
|
93 |
<class>Alekseon_MailTransport_Block</class>
|
94 |
</alekseon_mailTransport>
|
95 |
</blocks>
|
96 |
<helpers>
|
97 |
<alekseon_mailTransport>
|
98 |
<class>Alekseon_MailTransport_Helper</class>
|
99 |
</alekseon_mailTransport>
|
100 |
</helpers>
|
101 |
<resources>
|
102 |
<alekseon_mailtransport_setup>
|
103 |
<setup>
|
104 |
<module>Alekseon_MailTransport</module>
|
105 |
<class>Mage_Core_Model_Resource_Setup</class>
|
106 |
</setup>
|
107 |
</alekseon_mailtransport_setup>
|
108 |
</resources>
|
109 |
</global>
|
110 |
<adminhtml>
|
111 |
<layout>
|
112 |
<updates>
|
113 |
<alekseon_mailTransport>
|
114 |
<file>alekseon/mailTransport.xml</file>
|
115 |
</alekseon_mailTransport>
|
116 |
</updates>
|
117 |
</layout>
|
118 |
<events>
|
119 |
<controller_action_predispatch>
|
120 |
<observers>
|
121 |
<alekseon_adminNotification>
|
122 |
<class>alekseon_mailTransport/alekseonAdminNotification_observer</class>
|
123 |
<method>preDispatch</method>
|
124 |
</alekseon_adminNotification>
|
125 |
</observers>
|
126 |
</controller_action_predispatch>
|
127 |
</events>
|
128 |
</adminhtml>
|
129 |
<admin>
|
130 |
<routers>
|
131 |
<adminhtml>
|
132 |
<args>
|
133 |
<modules>
|
134 |
<alekseon_mailTransport before="Mage_Adminhtml">Alekseon_MailTransport_Adminhtml</alekseon_mailTransport>
|
135 |
</modules>
|
136 |
</args>
|
137 |
</adminhtml>
|
138 |
</routers>
|
139 |
</admin>
|
140 |
<crontab>
|
141 |
<jobs>
|
142 |
<alekseon_remove_old_sent_emails>
|
143 |
<schedule>
|
144 |
<cron_expr>*/5 * * * *</cron_expr>
|
145 |
</schedule>
|
146 |
<run>
|
147 |
<model>alekseon_mailTransport/observer::removeOldSentEmails</model>
|
148 |
</run>
|
149 |
</alekseon_remove_old_sent_emails>
|
150 |
</jobs>
|
151 |
</crontab>
|
152 |
<default>
|
153 |
<alekseon_adminNotification>
|
154 |
<general>
|
155 |
<enabled>1</enabled>
|
156 |
<frequency>12</frequency>
|
157 |
</general>
|
158 |
</alekseon_adminNotification>
|
159 |
<alekseon_mailTransport>
|
160 |
<general>
|
161 |
<smtp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
162 |
</general>
|
163 |
<sent_email_history>
|
164 |
<remove_successed_after>30</remove_successed_after>
|
165 |
<remove_failed_after>30</remove_failed_after>
|
166 |
</sent_email_history>
|
167 |
</alekseon_mailTransport>
|
168 |
</default>
|
app/code/community/Alekseon/MailTransport/etc/system.xml
CHANGED
@@ -87,7 +87,7 @@
|
|
87 |
<show_in_store>1</show_in_store>
|
88 |
</hint>
|
89 |
<general translate="label">
|
90 |
-
<label>
|
91 |
<frontend_type>text</frontend_type>
|
92 |
<sort_order>10</sort_order>
|
93 |
<show_in_default>1</show_in_default>
|
@@ -169,6 +169,41 @@
|
|
169 |
</file_path>
|
170 |
</fields>
|
171 |
</general>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
</groups>
|
173 |
</alekseon_mailTransport>
|
174 |
</sections>
|
87 |
<show_in_store>1</show_in_store>
|
88 |
</hint>
|
89 |
<general translate="label">
|
90 |
+
<label>Transport Settings</label>
|
91 |
<frontend_type>text</frontend_type>
|
92 |
<sort_order>10</sort_order>
|
93 |
<show_in_default>1</show_in_default>
|
169 |
</file_path>
|
170 |
</fields>
|
171 |
</general>
|
172 |
+
<sent_email_history translate="label">
|
173 |
+
<label>Sent Email History</label>
|
174 |
+
<frontend_type>text</frontend_type>
|
175 |
+
<sort_order>20</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>0</show_in_website>
|
178 |
+
<show_in_store>0</show_in_store>
|
179 |
+
<fields>
|
180 |
+
<enabled translate="label comment">
|
181 |
+
<label>Enabled</label>
|
182 |
+
<frontend_type>select</frontend_type>
|
183 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
184 |
+
<sort_order>10</sort_order>
|
185 |
+
<show_in_default>1</show_in_default>
|
186 |
+
<show_in_website>0</show_in_website>
|
187 |
+
<show_in_store>0</show_in_store>
|
188 |
+
</enabled>
|
189 |
+
<remove_successed_after translate="label comment">
|
190 |
+
<label>Remove Successed Sent Emails From History After</label>
|
191 |
+
<sort_order>20</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>0</show_in_website>
|
194 |
+
<show_in_store>0</show_in_store>
|
195 |
+
<comment>In days. Be sure that cron is added to your cron tab.</comment>
|
196 |
+
</remove_successed_after>
|
197 |
+
<remove_failed_after translate="label comment">
|
198 |
+
<label>Remove Failed Sent Emails From History After</label>
|
199 |
+
<sort_order>30</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>0</show_in_website>
|
202 |
+
<show_in_store>0</show_in_store>
|
203 |
+
<comment>In days. Be sure that cron is added to your cron tab.</comment>
|
204 |
+
</remove_failed_after>
|
205 |
+
</fields>
|
206 |
+
</sent_email_history>
|
207 |
</groups>
|
208 |
</alekseon_mailTransport>
|
209 |
</sections>
|
app/code/community/Alekseon/MailTransport/sql/alekseon_mailtransport_setup/mysql4-install-0.1.1.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
$installer = $this;
|
10 |
+
$installer->startSetup();
|
11 |
+
$installer->run("
|
12 |
+
|
13 |
+
CREATE TABLE {$this->getTable('alekseon_mailTransport/sentemail')} (
|
14 |
+
`id` int(10) unsigned NOT NULL auto_increment,
|
15 |
+
`store_id` smallint(5) unsigned NOT NULL default '0',
|
16 |
+
`sent_at` datetime NOT NULL default '0000-00-00 00:00:00',
|
17 |
+
`template_id` varchar(255) NOT NULL default '',
|
18 |
+
`subject` varchar(255) NOT NULL default '',
|
19 |
+
`mail_body` text NOT NULL default '',
|
20 |
+
`transport_type` smallint(5) unsigned,
|
21 |
+
`status` smallint(5) unsigned,
|
22 |
+
`comment` text NOT NULL default '',
|
23 |
+
PRIMARY KEY (`id`)
|
24 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
25 |
+
|
26 |
+
CREATE TABLE {$this->getTable('alekseon_mailTransport/sentemail_correspondent')} (
|
27 |
+
`id` int(10) unsigned NOT NULL auto_increment,
|
28 |
+
`sentemail_id` int(10) unsigned,
|
29 |
+
`type` varchar(255) NOT NULL default '',
|
30 |
+
`name` varchar(255) NOT NULL default '',
|
31 |
+
`email` varchar(255) NOT NULL default '',
|
32 |
+
PRIMARY KEY (`id`),
|
33 |
+
FOREIGN KEY (`sentemail_id`) REFERENCES `{$installer->getTable('alekseon_mailTransport/sentemail')}`(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
34 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
35 |
+
|
36 |
+
");
|
37 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/alekseon/mailTransport.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<layout>
|
11 |
+
<adminhtml_mailtransport_sentemailshistory_index>
|
12 |
+
<reference name="content">
|
13 |
+
<block type="alekseon_mailTransport/adminhtml_sentEmail_topMessage" template="alekseon/mailTransport/sentEmail/topMessage.phtml" />
|
14 |
+
<block type="alekseon_mailTransport/adminhtml_sentEmail" name="sent_emails_grid_conatiner" />
|
15 |
+
</reference>
|
16 |
+
</adminhtml_mailtransport_sentemailshistory_index>
|
17 |
+
|
18 |
+
<adminhtml_mailtransport_sentemailshistory_view>
|
19 |
+
<reference name="content">
|
20 |
+
<block type="alekseon_mailTransport/adminhtml_sentEmail_view" name="sent_email_view" />
|
21 |
+
</reference>
|
22 |
+
</adminhtml_mailtransport_sentemailshistory_view>
|
23 |
+
|
24 |
+
<adminhtml_mailtransport_sentemailshistory_mailbody>
|
25 |
+
<remove name="root"/>
|
26 |
+
<block type="alekseon_mailTransport/adminhtml_sentEmail_view_mailBody" name="mailBody" output="toHtml" />
|
27 |
+
</adminhtml_mailtransport_sentemailshistory_mailbody>
|
28 |
+
</layout>
|
app/design/adminhtml/default/default/template/alekseon/mailTransport/sentEmail/topMessage.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ($this->canDisplay()): ?>
|
2 |
+
<ul class="messages">
|
3 |
+
<li class="notice-msg">
|
4 |
+
<span><?php echo $this->__('Sent Emails History is disabled. Emails are not saving into history. You can enable it in Mail Transport configuration.') ?></span>
|
5 |
+
</li>
|
6 |
+
</ul>
|
7 |
+
<?php endif ?>
|
app/design/adminhtml/default/default/template/alekseon/mailTransport/sentEmail/view/form.phtml
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div class="box-left">
|
10 |
+
<div class="entry-edit">
|
11 |
+
<div class="entry-edit-head">
|
12 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('alekseon_mailTransport')->__('Mail Information') ?></h4>
|
13 |
+
</div>
|
14 |
+
<div class="fieldset">
|
15 |
+
<table cellspacing="0" class="form-list">
|
16 |
+
<tr>
|
17 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Subject') ?></label></td>
|
18 |
+
<td class="value"><strong><?php echo $this->escapeHtml($this->getSubject()) ?></strong></td>
|
19 |
+
</tr>
|
20 |
+
<tr>
|
21 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Sent At') ?></label></td>
|
22 |
+
<td class="value"><strong><?php echo $this->getSentAt() ?></strong></td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Sent From') ?></label></td>
|
26 |
+
<td class="value"><strong><?php echo $this->getSentFrom() ?></strong></td>
|
27 |
+
</tr>
|
28 |
+
<tr>
|
29 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Status') ?></label></td>
|
30 |
+
<?php if ($this->getStatus()): ?>
|
31 |
+
<td class="value"><span class="grid-severity-notice" style="width:150px"><span><?php echo Mage::helper('alekseon_mailTransport')->__('Success') ?></span></span></td>
|
32 |
+
<?php else: ?>
|
33 |
+
<td class="value"><span class="grid-severity-critical" style="width:150px"><span><?php echo Mage::helper('alekseon_mailTransport')->__('Failed') ?></span></span></td>
|
34 |
+
<?php endif ?>
|
35 |
+
</tr>
|
36 |
+
<?php if ($this->getComment()): ?>
|
37 |
+
<tr>
|
38 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Comment') ?></label></td>
|
39 |
+
<td class="value"><strong><?php echo $this->getComment() ?></strong></td>
|
40 |
+
</tr>
|
41 |
+
<?php endif ?>
|
42 |
+
<tr>
|
43 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Transport Type') ?></label></td>
|
44 |
+
<td class="value"><strong><?php echo $this->getTransportType() ?></strong></td>
|
45 |
+
</tr>
|
46 |
+
<tr>
|
47 |
+
<td class="label"><label><?php echo Mage::helper('alekseon_mailTransport')->__('Used Template') ?></label></td>
|
48 |
+
<td class="value"><strong><?php echo $this->getUsedTemplate() ?></strong></td>
|
49 |
+
</tr>
|
50 |
+
</table>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<div class="box-right">
|
55 |
+
<div class="entry-edit">
|
56 |
+
<div class="entry-edit-head">
|
57 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('alekseon_mailTransport')->__('Sender') ?></h4>
|
58 |
+
</div>
|
59 |
+
<div class="fieldset">
|
60 |
+
<table cellspacing="0" class="form-list">
|
61 |
+
<?php foreach($this->getSender() as $sender): ?>
|
62 |
+
<tr>
|
63 |
+
<td class="label"><label><?php echo $this->escapeHtml($sender->getName()) ?></label></td>
|
64 |
+
<td class="value"><a href="mailto:<?php echo $this->escapeHtml($sender->getEmail()) ?>"><strong><?php echo $this->escapeHtml($sender->getEmail()) ?></strong></a></td>
|
65 |
+
</tr>
|
66 |
+
<?php endforeach ?>
|
67 |
+
</table>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
<div class="box-right">
|
72 |
+
<div class="entry-edit">
|
73 |
+
<div class="entry-edit-head">
|
74 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('alekseon_mailTransport')->__('Receipients') ?></h4>
|
75 |
+
</div>
|
76 |
+
<div class="fieldset">
|
77 |
+
<table cellspacing="0" class="form-list">
|
78 |
+
<?php foreach($this->getReceipients() as $receipient): ?>
|
79 |
+
<tr>
|
80 |
+
<td class="label"><label><?php echo $this->escapeHtml($receipient->getName()) ?></label></td>
|
81 |
+
<td class="value"><a href="mailto:<?php echo $this->escapeHtml($receipient->getEmail()) ?>"><strong><?php echo $this->escapeHtml($receipient->getEmail()) ?></strong></a></td>
|
82 |
+
</tr>
|
83 |
+
<?php endforeach ?>
|
84 |
+
<?php foreach($this->getBccReceipients() as $receipients): ?>
|
85 |
+
<tr>
|
86 |
+
<td class="label"><label>[Bcc] <?php echo $this->escapeHtml($receipients->getName()) ?></label></td>
|
87 |
+
<td class="value"><a href="mailto:<?php echo $this->escapeHtml($receipients->getEmail()) ?>"><strong><?php echo $this->escapeHtml($receipients->getEmail()) ?></strong></a></td>
|
88 |
+
</tr>
|
89 |
+
<?php endforeach ?>
|
90 |
+
</table>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
<div class="clear"></div>
|
95 |
+
<div class="entry-edit">
|
96 |
+
<div class="entry-edit-head">
|
97 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('alekseon_mailTransport')->__('Mail Body') ?></h4>
|
98 |
+
</div>
|
99 |
+
<div class="fieldset">
|
100 |
+
<iframe src="<?php echo $this->getMailBodyIframeUrl() ?>" frameborder="1" style="width:100%; height:600px;">
|
101 |
+
<p><?php echo $this->__('Your browser does not support iframes.') ?></p>
|
102 |
+
</iframe>
|
103 |
+
</div>
|
104 |
+
</div>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>mail_transport</name>
|
4 |
-
<version>0.1.0
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
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-04-
|
14 |
-
<time>09:
|
15 |
-
<contents><target name="magecommunity"><dir name="Alekseon"><dir name="MailTransport"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="AlekseonLogo.php" hash="f51973c6b6547da6d3c4662a7fbb6566"/><file name="AlekseonNotification.php" hash="51f024aaf7825e876064ed8c2736c0bb"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>mail_transport</name>
|
4 |
+
<version>0.1.1.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>
|
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-04-13</date>
|
14 |
+
<time>09:11:48</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Alekseon"><dir name="MailTransport"><dir><dir name="Block"><dir name="Adminhtml"><dir name="SentEmail"><dir name="Grid"><dir name="Renderer"><file name="Receipient.php" hash="88a5e395a965ccae580d84ad0072b08e"/></dir></dir><file name="Grid.php" hash="824d609eaa63ed8d435ebb8df36049cb"/><file name="TopMessage.php" hash="80036003eeab72028e67c8c07f4aa52d"/><dir name="View"><file name="Form.php" hash="1d449bba45a837b23fd65027bb8dee3c"/><file name="MailBody.php" hash="d5428e3ac38e5ac53456504c72f71aee"/></dir><file name="View.php" hash="e3f941aad29a565e8f7916e237b30c0a"/></dir><file name="SentEmail.php" hash="578c135cc0f4b9bc3ccc01e745e3df2e"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="AlekseonLogo.php" hash="f51973c6b6547da6d3c4662a7fbb6566"/><file name="AlekseonNotification.php" hash="51f024aaf7825e876064ed8c2736c0bb"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f6539af5c617bc24c000d5d22e9ede3f"/></dir><dir name="Model"><dir name="AlekseonAdminNotification"><file name="Feed.php" hash="aaf8c072689181202e0c561beabc54b3"/><file name="Observer.php" hash="f44011324cad1c5284d0ea68a6267020"/></dir><dir name="Email"><file name="Template.php" hash="d3fe41814ee9feec6312e5039f7e274e"/></dir><file name="Observer.php" hash="cb32eb694fba1e53c2396c0b4398ebf0"/><dir name="Resource"><dir name="SentEmail"><file name="Collection.php" hash="bf1c29041caa2d4614e7894297b55b47"/><dir name="Correspondent"><file name="Collection.php" hash="c4df13aea0717ba228f2b206d71cdc0a"/></dir><file name="Correspondent.php" hash="e4304608fedd99d74e3720ba40ab5811"/></dir><file name="SentEmail.php" hash="3b4302ca7d3c9c9c416dc6d1559847fd"/></dir><dir name="SentEmail"><file name="Correspondent.php" hash="79ce35e0cc043ef088cad17afe87e5b1"/></dir><file name="SentEmail.php" hash="bf53e13806cafd1371f03b78ff8746a0"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EncryptionProtocols.php" hash="71dfa161d404dc77be304c9946e7318e"/><file name="MailTransportTypes.php" hash="d5a09e646a0fad150e8604f1408014df"/><file name="SmtpAuthModes.php" hash="6b30e126782cdc9bb93755c179c06fc4"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="MailTransport"><file name="SentEmailsHistoryController.php" hash="8857976b524cff7451f3fdeeae013932"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0a84d9392de6dd9ab91fc7cc6b35cc0e"/><file name="config.xml" hash="599ae179cfad391f6ef698cea3616451"/><file name="system.xml" hash="8ab1c78e4ffa9c2c9991b1a9a57b9a07"/></dir><dir name="sql"><dir name="alekseon_mailtransport_setup"><file name="mysql4-install-0.1.1.php" hash="e9eab66079a531256d2db8a0895d5d2d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alekseon_MailTransport.xml" hash="e99dcf95b0657403cec683729a620450"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="alekseon"><file name="mailTransport.xml" hash="052b7956a3fb7910f5dd29829fc112c7"/></dir></dir><dir name="template"><dir name="alekseon"><dir name="mailTransport"><dir name="sentEmail"><file name="topMessage.phtml" hash="a9440740f61ea7767406108f9011c07c"/><dir name="view"><file name="form.phtml" hash="28c68fd3ac225ef098e17fc73dba4fc8"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|