Version Notes
2.0.0 - Version 2 is a complete rewrite and refresh of the extension. Full support for newer versions of Magento.
As of 2014 - All prior releases available on github, but no longer supported.
Download this release
Release Info
Developer | ASchroder |
Extension | ASchroder_SMTPPro |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.3 to 2.0.0
- app/code/community/Aschroder/SMTPPro/Block/Adminhtml/Test.php +0 -48
- app/code/community/Aschroder/SMTPPro/Helper/Data.php +0 -152
- app/code/community/Aschroder/SMTPPro/Model/Email.php +0 -95
- app/code/community/Aschroder/SMTPPro/Model/Email/Template.php +0 -130
- app/code/community/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php +0 -17
- app/code/community/Aschroder/SMTPPro/Model/Newsletter/Template.php +0 -141
- app/code/community/Aschroder/SMTPPro/Model/Observer.php +0 -34
- app/code/community/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php +0 -20
- app/code/community/Aschroder/SMTPPro/controllers/IndexController.php +0 -181
- app/code/community/Aschroder/SMTPPro/etc/config.xml +0 -146
- app/code/community/Aschroder/SMTPPro/etc/system.xml +0 -189
- app/code/community/Aschroder/SMTPPro/locale/de_DE/Aschroder_SMTPPro.csv +0 -31
- app/code/community/Aschroder/SMTPPro/modules/Aschroder_SMTPPro.xml +0 -9
- app/code/community/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php +0 -30
- app/code/community/Aschroder/SMTPPro/templates/adminhtml/base/default/template/smtppro/view.phtml +0 -27
- app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Table.php +20 -0
- app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Test.php +52 -0
- app/code/{community → local}/Aschroder/SMTPPro/Block/Log.php +0 -0
- app/code/{community → local}/Aschroder/SMTPPro/Block/Log/Grid.php +3 -3
- app/code/{community → local}/Aschroder/SMTPPro/Block/Log/View.php +0 -0
- app/code/local/Aschroder/SMTPPro/Helper/Data.php +172 -0
- app/code/local/Aschroder/SMTPPro/Helper/Mysql4/Install.php +256 -0
- app/code/local/Aschroder/SMTPPro/Model/Email.php +62 -0
- app/code/{community → local}/Aschroder/SMTPPro/Model/Email/Log.php +12 -0
- app/code/local/Aschroder/SMTPPro/Model/Email/Template.php +130 -0
- app/code/local/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php +60 -0
- app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Email/Log/Collection.php +0 -0
- app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Setup.php +0 -0
- app/code/local/Aschroder/SMTPPro/Model/Observer.php +64 -0
- app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Authentication.php +1 -1
- app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Development.php +0 -0
- app/code/local/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php +22 -0
- app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Ssl.php +0 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Basesmtp.php +39 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Disabled.php +17 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Google.php +31 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Sendgrid.php +31 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Ses.php +38 -0
- app/code/local/Aschroder/SMTPPro/Model/Transports/Smtp.php +31 -0
- app/code/{community → local}/Aschroder/SMTPPro/controllers/LogController.php +0 -0
- app/code/local/Aschroder/SMTPPro/controllers/TestController.php +256 -0
- app/code/local/Aschroder/SMTPPro/etc/config.xml +192 -0
- app/code/local/Aschroder/SMTPPro/etc/system.xml +254 -0
- app/code/{community → local}/Aschroder/SMTPPro/lib/AmazonSES.php +2 -2
- app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php +32 -0
- app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-upgrade-1.4.3-1.4.4.php +21 -0
- app/design/adminhtml/default/default/template/smtppro/view.phtml +1 -1
- app/etc/modules/Aschroder_SMTPPro.xml +1 -1
- app/locale/de_DE/Aschroder_SMTPPro.csv +0 -31
- package.xml +12 -42
app/code/community/Aschroder/SMTPPro/Block/Adminhtml/Test.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* This is the Self test Button
|
5 |
-
*
|
6 |
-
* @author Ashley Schroder (aschroder.com)
|
7 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
8 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
-
*/
|
10 |
-
|
11 |
-
class Aschroder_SMTPPro_Block_Adminhtml_Test
|
12 |
-
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
13 |
-
{
|
14 |
-
|
15 |
-
|
16 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
17 |
-
|
18 |
-
$this->setElement($element);
|
19 |
-
|
20 |
-
return $this->_getAddRowButtonHtml($this->__('Run Self Test'));
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
protected function _getAddRowButtonHtml($title) {
|
25 |
-
|
26 |
-
$buttonBlock = $this->getElement()->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
|
27 |
-
|
28 |
-
$_websiteCode = $buttonBlock->getRequest()->getParam('website');
|
29 |
-
$params = array(
|
30 |
-
'website' => $_websiteCode,
|
31 |
-
// We add _store for the base url function, otherwise it will not correctly add the store code if configured
|
32 |
-
'_store' => $_websiteCode ? $_websiteCode : Mage::app()->getDefaultStoreView()->getId()
|
33 |
-
);
|
34 |
-
|
35 |
-
// TODO: for real multi-store self-testing, the test button (and other configuration options)
|
36 |
-
// should probably be set to show in website. Currently they are not.
|
37 |
-
$url = Mage::helper('adminhtml')->getUrl("smtppro", $params);
|
38 |
-
|
39 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
40 |
-
->setType('button')
|
41 |
-
->setLabel($this->__($title))
|
42 |
-
->setOnClick("window.location.href='".$url."'")
|
43 |
-
->toHtml();
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Helper/Data.php
DELETED
@@ -1,152 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Various Helper functions for the Aschroder.com SMTP Pro module.
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @author Ashley Schroder (aschroder.com)
|
8 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
9 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
*/
|
11 |
-
|
12 |
-
class Aschroder_SMTPPro_Helper_Data extends Mage_Core_Helper_Abstract {
|
13 |
-
|
14 |
-
public function isEnabled() {
|
15 |
-
return Mage::getStoreConfig('system/smtppro/option') != "disabled";
|
16 |
-
}
|
17 |
-
|
18 |
-
public function isLogEnabled() {
|
19 |
-
return Mage::getStoreConfig('system/smtppro/logenabled');
|
20 |
-
}
|
21 |
-
|
22 |
-
public function isReplyToStoreEmail() {
|
23 |
-
return Mage::getStoreConfig('system/smtppro/store_addresses');
|
24 |
-
}
|
25 |
-
|
26 |
-
public function getDevelopmentMode() {
|
27 |
-
return Mage::getStoreConfig('system/smtppro/development');
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getGoogleApps() {
|
31 |
-
return Mage::getStoreConfig('system/smtppro/option') == "google";
|
32 |
-
}
|
33 |
-
public function getSES() {
|
34 |
-
return Mage::getStoreConfig('system/smtppro/option') == "ses";
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getSMTP() {
|
38 |
-
return Mage::getStoreConfig('system/smtppro/option') == "smtp";
|
39 |
-
}
|
40 |
-
|
41 |
-
// Keeping this function for backward compatibility
|
42 |
-
// It will be dropped eventually so call getTransport() from now on!
|
43 |
-
public function getSMTPProTransport($id = null) {
|
44 |
-
return $this->getTransport($id);
|
45 |
-
}
|
46 |
-
|
47 |
-
// Keeping this function for backward compatibility
|
48 |
-
// It will be dropped eventually so call getTransport() from now on!
|
49 |
-
public function getGoogleAppsEmailTransport($id = null) {
|
50 |
-
return $this->getTransport($id);
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getTransport($id = null) {
|
54 |
-
|
55 |
-
|
56 |
-
if($this->getSMTP()){
|
57 |
-
|
58 |
-
$username = Mage::getStoreConfig('system/smtpsettings/username', $id);
|
59 |
-
$password = Mage::getStoreConfig('system/smtpsettings/password', $id);
|
60 |
-
$host = Mage::getStoreConfig('system/smtpsettings/host', $id);
|
61 |
-
$port = Mage::getStoreConfig('system/smtpsettings/port', $id);
|
62 |
-
$ssl = Mage::getStoreConfig('system/smtpsettings/ssl', $id);
|
63 |
-
$auth = Mage::getStoreConfig('system/smtpsettings/authentication', $id);
|
64 |
-
|
65 |
-
Mage::log('Preparing the SMTP Email transport, details are: \n '
|
66 |
-
. " username=" . $username . "\n"
|
67 |
-
. " password=" . "MASKED" /*. $password */ . "\n"
|
68 |
-
. " host=" . $host . "\n"
|
69 |
-
. " port=" . $port . "\n"
|
70 |
-
. " ssl=" . $ssl . "\n"
|
71 |
-
. " auth=" . $auth . "\n"
|
72 |
-
);
|
73 |
-
|
74 |
-
// Set up the config array
|
75 |
-
|
76 |
-
$config = array();
|
77 |
-
|
78 |
-
if ($auth != "none") {
|
79 |
-
$config['auth'] = $auth;
|
80 |
-
$config['username'] = $username;
|
81 |
-
$config['password'] = $password;
|
82 |
-
}
|
83 |
-
|
84 |
-
if ($port) {
|
85 |
-
$config['port'] = $port;
|
86 |
-
}
|
87 |
-
|
88 |
-
if ($ssl != "none" ) {
|
89 |
-
$config['ssl'] = $ssl;
|
90 |
-
}
|
91 |
-
|
92 |
-
$transport = new Zend_Mail_Transport_Smtp($host, $config);
|
93 |
-
|
94 |
-
} else if($this->getGoogleApps()) {
|
95 |
-
|
96 |
-
$email = explode(",", Mage::getStoreConfig('system/googlesettings/email', $id));
|
97 |
-
|
98 |
-
// We now allow a load balance of multiple gmail
|
99 |
-
// accounts to get past the 500/day limit.
|
100 |
-
|
101 |
-
if (count($email)) {
|
102 |
-
|
103 |
-
$email = $email[array_rand($email)];
|
104 |
-
} else {
|
105 |
-
|
106 |
-
Mage::log(
|
107 |
-
"No email configured -
|
108 |
-
you need to specify one in the magento configuration,
|
109 |
-
otherwise your connection will fail");
|
110 |
-
}
|
111 |
-
|
112 |
-
$password = Mage::getStoreConfig('system/googlesettings/gpassword', $id);
|
113 |
-
|
114 |
-
Mage::log('Preparing the Google Apps/Gmail Email transport, email to send with is: ' . $email);
|
115 |
-
$config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => $email, 'password' => $password);
|
116 |
-
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
|
117 |
-
|
118 |
-
} else if($this->getSES()) {
|
119 |
-
|
120 |
-
// Big thanks to Christopher Valles
|
121 |
-
// https://github.com/christophervalles/Amazon-SES-Zend-Mail-Transport
|
122 |
-
include_once Mage::getBaseDir() . '/app/code/community/Aschroder/SMTPPro/lib/AmazonSES.php';
|
123 |
-
|
124 |
-
$transport = new App_Mail_Transport_AmazonSES(
|
125 |
-
array(
|
126 |
-
'accessKey' => Mage::getStoreConfig('system/sessettings/aws_access_key', $id),
|
127 |
-
'privateKey' => Mage::getStoreConfig('system/sessettings/aws_private_key', $id)
|
128 |
-
)
|
129 |
-
);
|
130 |
-
|
131 |
-
} else {
|
132 |
-
Mage::log("Disabled, or no matching transport");
|
133 |
-
return null;
|
134 |
-
}
|
135 |
-
|
136 |
-
Mage::log("Returning transport");
|
137 |
-
|
138 |
-
return $transport;
|
139 |
-
}
|
140 |
-
|
141 |
-
public function log($to, $template, $subject, $email, $isHtml) {
|
142 |
-
|
143 |
-
$log = Mage::getModel('smtppro/email_log')
|
144 |
-
->setTo($to)
|
145 |
-
->setTemplate($template)
|
146 |
-
->setSubject($subject)
|
147 |
-
->setEmailBody($isHtml?$email:nl2br($email))
|
148 |
-
->save();
|
149 |
-
return $this;
|
150 |
-
}
|
151 |
-
|
152 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/Email.php
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* This class wraps the Basic email sending functionality
|
4 |
-
* If SMTPPro is enabled it will send emails using the given
|
5 |
-
* configuration.
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
* @author Ashley Schroder (aschroder.com)
|
10 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
11 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Aschroder_SMTPPro_Model_Email extends Mage_Core_Model_Email {
|
15 |
-
|
16 |
-
public function send() {
|
17 |
-
|
18 |
-
// If it's not enabled, just return the parent result.
|
19 |
-
if (!Mage::helper('smtppro')->isEnabled()) {
|
20 |
-
return parent::send();
|
21 |
-
}
|
22 |
-
|
23 |
-
Mage::log('SMTPPro is enabled, sending email in Aschroder_SMTPPro_Model_Email');
|
24 |
-
|
25 |
-
// The remainder of this function closely mirrors the parent
|
26 |
-
// method except for providing the SMTP auth details from the
|
27 |
-
// configuration. This is not good OO, but the parent class
|
28 |
-
// leaves little room for useful subclassing.
|
29 |
-
|
30 |
-
if (Mage::getStoreConfigFlag('system/smtp/disable')) {
|
31 |
-
return $this;
|
32 |
-
}
|
33 |
-
|
34 |
-
$mail = new Zend_Mail();
|
35 |
-
|
36 |
-
if (strtolower($this->getType()) == 'html') {
|
37 |
-
$mail->setBodyHtml($this->getBody());
|
38 |
-
}
|
39 |
-
else {
|
40 |
-
$mail->setBodyText($this->getBody());
|
41 |
-
}
|
42 |
-
|
43 |
-
$transport = Mage::helper('smtppro')->getTransport();
|
44 |
-
$dev = Mage::helper('smtppro')->getDevelopmentMode();
|
45 |
-
|
46 |
-
if ($dev == "contact") {
|
47 |
-
|
48 |
-
$email = Mage::getStoreConfig('contacts/email/recipient_email');
|
49 |
-
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
50 |
-
|
51 |
-
} elseif ($dev == "supress") {
|
52 |
-
|
53 |
-
Mage::log("Development mode set to supress all emails.");
|
54 |
-
# we bail out, but report success
|
55 |
-
return $this;
|
56 |
-
|
57 |
-
} else {
|
58 |
-
|
59 |
-
// We just set the outgoing email as normal
|
60 |
-
$email = $this->getToEmail();
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
$mail->setFrom($this->getFromEmail(), $this->getFromName())
|
65 |
-
->addTo($email, $this->getToName())
|
66 |
-
->setSubject($this->getSubject());
|
67 |
-
|
68 |
-
// If we are using store emails as reply-to's set the header
|
69 |
-
if (Mage::helper('smtppro')->isReplyToStoreEmail()) {
|
70 |
-
|
71 |
-
// Later versions of Zend have a method for this, and disallow direct header setting...
|
72 |
-
if (method_exists($mail, "setReplyTo")) {
|
73 |
-
$mail->setReplyTo($this->getSenderEmail(), $this->getSenderName());
|
74 |
-
} else {
|
75 |
-
$mail->addHeader('Reply-To', $this->getSenderEmail());
|
76 |
-
}
|
77 |
-
Mage::log('ReplyToStoreEmail is enabled, just set Reply-To header: ' . $this->getSenderEmail());
|
78 |
-
}
|
79 |
-
|
80 |
-
Mage::log('About to send email');
|
81 |
-
$mail->send($transport);
|
82 |
-
Mage::log('Finished sending email');
|
83 |
-
|
84 |
-
$body = $this->getBody();
|
85 |
-
Mage::dispatchEvent('smtppro_email_after_send',
|
86 |
-
array('to' => $this->getToName(),
|
87 |
-
'subject' => $this->getSubject(),
|
88 |
-
'template' => "n/a", //TODO: is that true?
|
89 |
-
'html' => (strtolower($this->getType()) == 'html'),
|
90 |
-
'email_body' => $body));
|
91 |
-
|
92 |
-
|
93 |
-
return $this;
|
94 |
-
}
|
95 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/Email/Template.php
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* This class wraps the Template email sending functionality
|
5 |
-
* If SMTP Pro is enabled it will send emails using the given
|
6 |
-
* configuration.
|
7 |
-
*
|
8 |
-
* @author Ashley Schroder (aschroder.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
class Aschroder_SMTPPro_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
12 |
-
|
13 |
-
public function send($email, $name=null, array $variables = array()) {
|
14 |
-
|
15 |
-
// If it's not enabled, just return the parent result.
|
16 |
-
if (!Mage::helper('smtppro')->isEnabled()) {
|
17 |
-
return parent::send($email, $name, $variables);
|
18 |
-
}
|
19 |
-
|
20 |
-
Mage::log('SMTPPro is enabled, sending email in Aschroder_SMTPPro_Model_Email_Template');
|
21 |
-
|
22 |
-
|
23 |
-
// The remainder of this function closely mirrors the parent
|
24 |
-
// method except for providing the SMTP auth details from the
|
25 |
-
// configuration. This is not good OO, but the parent class
|
26 |
-
// leaves little room for useful subclassing. This will probably
|
27 |
-
// become redundant sooner or later anyway.
|
28 |
-
|
29 |
-
if(!$this->isValidForSend()) {
|
30 |
-
Mage::log('SMTPPro: Email not valid for sending - check template, and smtp enabled/disabled setting');
|
31 |
-
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
$emails = array_values((array)$email);
|
36 |
-
$names = is_array($name) ? $name : (array)$name;
|
37 |
-
$names = array_values($names);
|
38 |
-
foreach ($emails as $key => $email) {
|
39 |
-
if (!isset($names[$key])) {
|
40 |
-
$names[$key] = substr($email, 0, strpos($email, '@'));
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
$variables['email'] = reset($emails);
|
45 |
-
$variables['name'] = reset($names);
|
46 |
-
|
47 |
-
$mail = $this->getMail();
|
48 |
-
|
49 |
-
$dev = Mage::helper('smtppro')->getDevelopmentMode();
|
50 |
-
|
51 |
-
if ($dev == "contact") {
|
52 |
-
|
53 |
-
$email = Mage::getStoreConfig('contacts/email/recipient_email', $this->getDesignConfig()->getStore());
|
54 |
-
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
55 |
-
|
56 |
-
} elseif ($dev == "supress") {
|
57 |
-
|
58 |
-
Mage::log("Development mode set to supress all emails.");
|
59 |
-
# we bail out, but report success
|
60 |
-
return true;
|
61 |
-
}
|
62 |
-
|
63 |
-
// In Magento core they set the Return-Path here, for the sendmail command.
|
64 |
-
// we assume our outbound SMTP server (or Gmail) will set that.
|
65 |
-
|
66 |
-
foreach ($emails as $key => $email) {
|
67 |
-
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
68 |
-
}
|
69 |
-
|
70 |
-
|
71 |
-
$this->setUseAbsoluteLinks(true);
|
72 |
-
$text = $this->getProcessedTemplate($variables, true);
|
73 |
-
|
74 |
-
if($this->isPlain()) {
|
75 |
-
$mail->setBodyText($text);
|
76 |
-
} else {
|
77 |
-
$mail->setBodyHTML($text);
|
78 |
-
}
|
79 |
-
|
80 |
-
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
|
81 |
-
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
82 |
-
|
83 |
-
// If we are using store emails as reply-to's set the header
|
84 |
-
// Check the header is not already set by the application.
|
85 |
-
// The contact form, for example, set's it to the sender of
|
86 |
-
// the contact. Thanks i960 for pointing this out.
|
87 |
-
|
88 |
-
if (Mage::helper('smtppro')->isReplyToStoreEmail()
|
89 |
-
&& !array_key_exists('Reply-To', $mail->getHeaders())) {
|
90 |
-
|
91 |
-
// Patch for Zend upgrade
|
92 |
-
// Later versions of Zend have a method for this, and disallow direct header setting...
|
93 |
-
if (method_exists($mail, "setReplyTo")) {
|
94 |
-
$mail->setReplyTo($this->getSenderEmail(), $this->getSenderName());
|
95 |
-
} else {
|
96 |
-
$mail->addHeader('Reply-To', $this->getSenderEmail());
|
97 |
-
}
|
98 |
-
Mage::log('ReplyToStoreEmail is enabled, just set Reply-To header: ' . $this->getSenderEmail());
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
$transport = Mage::helper('smtppro')->getTransport($this->getDesignConfig()->getStore());
|
103 |
-
|
104 |
-
try {
|
105 |
-
|
106 |
-
Mage::log('About to send email');
|
107 |
-
$mail->send($transport); // Zend_Mail warning..
|
108 |
-
Mage::log('Finished sending email');
|
109 |
-
|
110 |
-
// Record one email for each receipient
|
111 |
-
foreach ($emails as $key => $email) {
|
112 |
-
Mage::dispatchEvent('smtppro_email_after_send',
|
113 |
-
array('to' => $email,
|
114 |
-
'template' => $this->getTemplateId(),
|
115 |
-
'subject' => $this->getProcessedTemplateSubject($variables),
|
116 |
-
'html' => !$this->isPlain(),
|
117 |
-
'email_body' => $text));
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
$this->_mail = null;
|
122 |
-
}
|
123 |
-
catch (Exception $e) {
|
124 |
-
Mage::logException($e);
|
125 |
-
return false;
|
126 |
-
}
|
127 |
-
|
128 |
-
return true;
|
129 |
-
}
|
130 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @author Ashley Schroder (aschroder.com)
|
6 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
|
10 |
-
class Aschroder_SMTPPro_Model_Mysql4_Email_Log extends Mage_Core_Model_Mysql4_Abstract {
|
11 |
-
/**
|
12 |
-
* Resource model initialization
|
13 |
-
*/
|
14 |
-
protected function _construct() {
|
15 |
-
$this->_init('smtppro/email_log', 'email_id');
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/Newsletter/Template.php
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* This class wraps the Newsletter email sending functionality
|
5 |
-
*
|
6 |
-
* If SMTPPro is enabled it will send emails using the given
|
7 |
-
* configuration.
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* @author Ashley Schroder (aschroder.com)
|
11 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
12 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
13 |
-
*/
|
14 |
-
|
15 |
-
class Aschroder_SMTPPro_Model_Newsletter_Template
|
16 |
-
extends Mage_Newsletter_Model_Template {
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Send mail to subscriber
|
21 |
-
*
|
22 |
-
* @param Mage_Newsletter_Model_Subscriber|string $subscriber subscriber Model or E-mail
|
23 |
-
* @param array $variables template variables
|
24 |
-
* @param string|null $name receiver name (if subscriber model not specified)
|
25 |
-
* @param Mage_Newsletter_Model_Queue|null $queue queue model, used for problems reporting.
|
26 |
-
* @return boolean
|
27 |
-
**/
|
28 |
-
public function send($subscriber, array $variables = array(), $name=null, Mage_Newsletter_Model_Queue $queue=null)
|
29 |
-
{
|
30 |
-
if(!$this->isValidForSend()) {
|
31 |
-
return false;
|
32 |
-
}
|
33 |
-
|
34 |
-
// If it's not enabled, just return the parent result.
|
35 |
-
if (!Mage::helper('smtppro')->isEnabled()) {
|
36 |
-
return parent::send($subscriber, $variables, $name, $queue);
|
37 |
-
}
|
38 |
-
|
39 |
-
Mage::log('SMTPPro is enabled, sending email in Aschroder_SMTPPro_Model_Newsletter_Template');
|
40 |
-
|
41 |
-
|
42 |
-
$email = '';
|
43 |
-
if ($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
|
44 |
-
$email = $subscriber->getSubscriberEmail();
|
45 |
-
if (is_null($name) && ($subscriber->hasCustomerFirstname() || $subscriber->hasCustomerLastname()) ) {
|
46 |
-
$name = $subscriber->getCustomerFirstname() . ' ' . $subscriber->getCustomerLastname();
|
47 |
-
}
|
48 |
-
} else {
|
49 |
-
$email = (string) $subscriber;
|
50 |
-
}
|
51 |
-
|
52 |
-
$mail = $this->getMail();
|
53 |
-
|
54 |
-
if (Mage::getStoreConfigFlag(Mage_Newsletter_Model_Subscriber::XML_PATH_SENDING_SET_RETURN_PATH)) {
|
55 |
-
// This is important for SPAM I think, what value should it be?
|
56 |
-
$mail->setReturnPath($this->getTemplateSenderEmail());
|
57 |
-
}
|
58 |
-
|
59 |
-
$transport = Mage::helper('smtppro')->getTransport();
|
60 |
-
|
61 |
-
$dev = Mage::helper('smtppro')->getDevelopmentMode();
|
62 |
-
|
63 |
-
if ($dev == "contact") {
|
64 |
-
|
65 |
-
$email = Mage::getStoreConfig('contacts/email/recipient_email');
|
66 |
-
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
67 |
-
|
68 |
-
} elseif ($dev == "supress") {
|
69 |
-
|
70 |
-
Mage::log("Development mode set to supress all emails.");
|
71 |
-
# we bail out, but report success
|
72 |
-
return true;
|
73 |
-
}
|
74 |
-
|
75 |
-
$mail->addTo($email, $name);
|
76 |
-
$text = $this->getProcessedTemplate($variables, true);
|
77 |
-
|
78 |
-
if($this->isPlain()) {
|
79 |
-
$mail->setBodyText($text);
|
80 |
-
} else {
|
81 |
-
$mail->setBodyHTML($text);
|
82 |
-
}
|
83 |
-
|
84 |
-
$mail->setSubject($this->getProcessedTemplateSubject($variables));
|
85 |
-
$mail->setFrom($this->getTemplateSenderEmail(), $this->getTemplateSenderName());
|
86 |
-
|
87 |
-
// If we are using store emails as reply-to's set the header
|
88 |
-
if (Mage::helper('smtppro')->isReplyToStoreEmail()) {
|
89 |
-
// Later versions of Zend have a method for this, and disallow direct header setting...
|
90 |
-
if (method_exists($mail, "setReplyTo")) {
|
91 |
-
$mail->setReplyTo($this->getTemplateSenderEmail(), $this->getTemplateSenderName());
|
92 |
-
} else {
|
93 |
-
$mail->addHeader('Reply-To', $this->getTemplateSenderEmail());
|
94 |
-
}
|
95 |
-
Mage::log('ReplyToStoreEmail is enabled, just set Reply-To header: ' . $this->getTemplateSenderEmail());
|
96 |
-
}
|
97 |
-
|
98 |
-
try {
|
99 |
-
|
100 |
-
Mage::log('About to send email');
|
101 |
-
$mail->send($transport);
|
102 |
-
Mage::log('Finished sending email');
|
103 |
-
|
104 |
-
Mage::dispatchEvent('smtppro_email_after_send',
|
105 |
-
array('to' => $email,
|
106 |
-
'template' => $this->getTemplateId(),
|
107 |
-
'subject' => $mail->getSubject(),
|
108 |
-
'html' => !$this->isPlain(),
|
109 |
-
'email_body' => $text));
|
110 |
-
|
111 |
-
|
112 |
-
$this->_mail = null;
|
113 |
-
if(!is_null($queue)) {
|
114 |
-
$subscriber->received($queue);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
catch (Exception $e) {
|
118 |
-
if($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
|
119 |
-
// If letter sent for subscriber, we create a problem report entry
|
120 |
-
$problem = Mage::getModel('newsletter/problem');
|
121 |
-
$problem->addSubscriberData($subscriber);
|
122 |
-
if(!is_null($queue)) {
|
123 |
-
$problem->addQueueData($queue);
|
124 |
-
}
|
125 |
-
$problem->addErrorData($e);
|
126 |
-
$problem->save();
|
127 |
-
|
128 |
-
if(!is_null($queue)) {
|
129 |
-
$subscriber->received($queue);
|
130 |
-
}
|
131 |
-
} else {
|
132 |
-
// Otherwise throw error to upper level
|
133 |
-
throw $e;
|
134 |
-
}
|
135 |
-
return false;
|
136 |
-
}
|
137 |
-
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/Observer.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Observer that logs emails after they have been sent
|
4 |
-
*
|
5 |
-
* @author Ashley Schroder (aschroder.com)
|
6 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
|
10 |
-
class Aschroder_SMTPPro_Model_Observer {
|
11 |
-
|
12 |
-
public function log($observer) {
|
13 |
-
|
14 |
-
$event = $observer->getEvent();
|
15 |
-
if (Mage::helper('smtppro')->isLogEnabled()) {
|
16 |
-
|
17 |
-
Mage::helper('smtppro')->log(
|
18 |
-
$event->getTo(),
|
19 |
-
$event->getTemplate(),
|
20 |
-
$event->getSubject(),
|
21 |
-
$event->getEmailBody(),
|
22 |
-
$event->getHtml());
|
23 |
-
}
|
24 |
-
|
25 |
-
// For the self test, if we're sending the contact form notify the self test class
|
26 |
-
Mage::log("template=" . $event->getTemplate());
|
27 |
-
if($event->getTemplate() == "contacts_email_email_template") {
|
28 |
-
include_once Mage::getBaseDir() . "/app/code/community/Aschroder/SMTPPro/controllers/IndexController.php";
|
29 |
-
Aschroder_SMTPPro_IndexController::$CONTACTFORM_SENT = true;
|
30 |
-
}
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @copyright Copyright (c) 2009 Ashley Schroder
|
4 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
5 |
-
* @author Ashley Schroder
|
6 |
-
*/
|
7 |
-
|
8 |
-
class Aschroder_SMTPPro_Model_System_Config_Source_Smtp_Option
|
9 |
-
{
|
10 |
-
|
11 |
-
public function toOptionArray()
|
12 |
-
{
|
13 |
-
return array(
|
14 |
-
"disabled" => Mage::helper('adminhtml')->__('Disabled'),
|
15 |
-
"google" => Mage::helper('adminhtml')->__('Google Apps/Gmail'),
|
16 |
-
"smtp" => Mage::helper('adminhtml')->__('SMTP'),
|
17 |
-
"ses" => Mage::helper('adminhtml')->__('SES (experimental)')
|
18 |
-
);
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/controllers/IndexController.php
DELETED
@@ -1,181 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* An SMTP self test for the SMTPPro Magento extension
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @author Ashley Schroder (aschroder.com)
|
8 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
9 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
*/
|
11 |
-
|
12 |
-
|
13 |
-
class Aschroder_SMTPPro_IndexController
|
14 |
-
extends Mage_Adminhtml_Controller_Action {
|
15 |
-
|
16 |
-
public static $CONTACTFORM_SENT;
|
17 |
-
|
18 |
-
public function indexAction() {
|
19 |
-
|
20 |
-
Mage::log("Running SMTP Pro Self Test");
|
21 |
-
|
22 |
-
#report development mode for debugging
|
23 |
-
$dev = Mage::helper('smtppro')->getDevelopmentMode();
|
24 |
-
Mage::log("Development mode: " . $dev);
|
25 |
-
|
26 |
-
$success = true;
|
27 |
-
$websiteModel = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
|
28 |
-
|
29 |
-
$msg = "ASchroder.com SMTP Pro Self-test results";
|
30 |
-
|
31 |
-
$msg = $msg . "<br/>Testing outbound connectivity to Server:";
|
32 |
-
Mage::log("Raw connection test....");
|
33 |
-
|
34 |
-
|
35 |
-
$googleapps = Mage::helper('smtppro')->getGoogleApps();
|
36 |
-
$smtpEnabled = Mage::helper('smtppro')->getSMTP();
|
37 |
-
$sesEnabled = Mage::helper('smtppro')->getSES();
|
38 |
-
|
39 |
-
if($googleapps) {
|
40 |
-
$msg = $msg . "<br/>Using Google Apps/Gmail configuration options";
|
41 |
-
$host = "smtp.gmail.com";
|
42 |
-
$port = 587;
|
43 |
-
} else if ($smtpEnabled) {
|
44 |
-
$msg = $msg . "<br/>Using SMTP configuration options";
|
45 |
-
$host = Mage::getStoreConfig('system/smtpsettings/host', $websiteModel->getId());
|
46 |
-
$port = Mage::getStoreConfig('system/smtpsettings/port', $websiteModel->getId());
|
47 |
-
} else if ($sesEnabled) {
|
48 |
-
// no connectivity test - either disabled or SES...
|
49 |
-
$msg = $msg . "<br/> Connection to Amazon SES server not tested (...yet)";
|
50 |
-
Mage::log("skipped, SES.");
|
51 |
-
} else {
|
52 |
-
$msg = $msg . "<br/> extension disabled, cannot test outbound connectivity";
|
53 |
-
Mage::log("skipped, disabled.");
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
if ($googleapps || $smtpEnabled) {
|
58 |
-
$fp = false;
|
59 |
-
|
60 |
-
try {
|
61 |
-
$fp = fsockopen($host, $port, $errno, $errstr, 15);
|
62 |
-
} catch ( Exception $e) {
|
63 |
-
// An error will be reported below.
|
64 |
-
}
|
65 |
-
|
66 |
-
Mage::log("Complete");
|
67 |
-
|
68 |
-
if (!$fp) {
|
69 |
-
$success = false;
|
70 |
-
$msg = $msg . "<br/>Failed to connect to SMTP server. Reason: " . $errstr . "(" . $errno . ")";
|
71 |
-
$msg = $msg . "<br/> This extension requires an outbound SMTP connection on port: " . $port;
|
72 |
-
} else {
|
73 |
-
$msg = $msg . "<br/> Connection to Host SMTP server successful.";
|
74 |
-
fclose($fp);
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
$to = Mage::getStoreConfig('contacts/email/recipient_email', $websiteModel->getId());
|
79 |
-
|
80 |
-
$mail = new Zend_Mail();
|
81 |
-
$sub = "Test Email From ASchroder.com SMTP Pro Module";
|
82 |
-
$body =
|
83 |
-
"Hi,\n\n" .
|
84 |
-
"If you are seeing this email then your " .
|
85 |
-
"SMTP Pro settings are correct! \n\n" .
|
86 |
-
"For more information about this extension and " .
|
87 |
-
"tips for using it please visit ASchroder.com.\n\n" .
|
88 |
-
"Regards,\nAshley";
|
89 |
-
|
90 |
-
$mail->addTo($to)
|
91 |
-
->setFrom("ashley.schroder@gmail.com")
|
92 |
-
->setSubject($sub)
|
93 |
-
->setBodyText($body);
|
94 |
-
|
95 |
-
if ($dev != "supress") {
|
96 |
-
|
97 |
-
Mage::log("Actual email sending test....");
|
98 |
-
$msg = $msg . "<br/> Sending test email to your contact form address " . $to . ":";
|
99 |
-
|
100 |
-
try {
|
101 |
-
$transport = Mage::helper('smtppro')->getTransport($websiteModel->getId());
|
102 |
-
|
103 |
-
|
104 |
-
$mail->send($transport);
|
105 |
-
|
106 |
-
Mage::dispatchEvent('smtppro_email_after_send',
|
107 |
-
array('to' => $to,
|
108 |
-
'template' => "SMTPPro Self Test",
|
109 |
-
'subject' => $sub,
|
110 |
-
'html' => false,
|
111 |
-
'email_body' => $body));
|
112 |
-
|
113 |
-
$msg = $msg . "<br/> Test email was sent successfully.";
|
114 |
-
Mage::log("Test email was sent successfully");
|
115 |
-
|
116 |
-
|
117 |
-
} catch (Exception $e) {
|
118 |
-
$success = false;
|
119 |
-
$msg = $msg . "<br/> Unable to send test email. Exception message was: " . $e->getMessage() . "...";
|
120 |
-
$msg = $msg . "<br/> Please check and double check your username and password.";
|
121 |
-
Mage::log("Test email was not sent successfully: " . $e->getMessage());
|
122 |
-
}
|
123 |
-
} else {
|
124 |
-
Mage::log("Not sending test email - all mails currently supressed");
|
125 |
-
$msg = $msg . "<br/> No test email sent, development mode is set to supress all emails.";
|
126 |
-
}
|
127 |
-
|
128 |
-
// Now we test that the actual core overrides are occuring as expected.
|
129 |
-
// We trigger the contact form email, as though a user had done so.
|
130 |
-
|
131 |
-
Mage::log("Actual contact form submit test...");
|
132 |
-
|
133 |
-
self::$CONTACTFORM_SENT = false;
|
134 |
-
$this->_sendTestContactFormEmail();
|
135 |
-
|
136 |
-
// If everything worked as expected, the observer will have set this value to true.
|
137 |
-
if (self::$CONTACTFORM_SENT) {
|
138 |
-
$msg = $msg . "<br/> Contact Form test email used SMTPPro to send correctly.";
|
139 |
-
} else {
|
140 |
-
$success = false;
|
141 |
-
$msg = $msg . "<br/> Contact Form test email did not use SMTPPro to send.";
|
142 |
-
}
|
143 |
-
|
144 |
-
Mage::log("Complete");
|
145 |
-
|
146 |
-
if($success) {
|
147 |
-
$msg = $msg . "<br/> Testing complete, if you are still experiencing difficulties please visit <a target='_blank' href='http://aschroder.com'>ASchroder.com</a> to contact me.";
|
148 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($msg);
|
149 |
-
} else {
|
150 |
-
$msg = $msg . "<br/> Testing failed, please review the reported problems and if you need further help visit <a target='_blank' href='http://aschroder.com'>ASchroder.com</a> to contact me.";
|
151 |
-
Mage::getSingleton('adminhtml/session')->addError($msg);
|
152 |
-
}
|
153 |
-
|
154 |
-
$this->_redirectReferer();
|
155 |
-
}
|
156 |
-
|
157 |
-
private function _sendTestContactFormEmail() {
|
158 |
-
|
159 |
-
$postObject = new Varien_Object();
|
160 |
-
$postObject->setName("SMTPPro Tester");
|
161 |
-
$postObject->setComment("If you get this email then everything seems to be in order.");
|
162 |
-
$postObject->setEmail("ashley.schroder@gmail.com");
|
163 |
-
|
164 |
-
$mailTemplate = Mage::getModel('core/email_template');
|
165 |
-
/* @var $mailTemplate Mage_Core_Model_Email_Template */
|
166 |
-
|
167 |
-
include Mage::getBaseDir() . '/app/code/core/Mage/Contacts/controllers/IndexController.php';
|
168 |
-
|
169 |
-
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
|
170 |
-
->setReplyTo($postObject->getEmail())
|
171 |
-
->sendTransactional(
|
172 |
-
Mage::getStoreConfig(Mage_Contacts_IndexController::XML_PATH_EMAIL_TEMPLATE),
|
173 |
-
Mage::getStoreConfig(Mage_Contacts_IndexController::XML_PATH_EMAIL_SENDER),
|
174 |
-
Mage::getStoreConfig(Mage_Contacts_IndexController::XML_PATH_EMAIL_RECIPIENT),
|
175 |
-
null,
|
176 |
-
array('data' => $postObject)
|
177 |
-
);
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/etc/config.xml
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* SMTP Pro integration.
|
5 |
-
*
|
6 |
-
* @package Aschroder_SMTPPro
|
7 |
-
* @author Ashley Schroder (aschroder.com)
|
8 |
-
*/
|
9 |
-
-->
|
10 |
-
<config>
|
11 |
-
<modules>
|
12 |
-
<Aschroder_SMTPPro>
|
13 |
-
<version>1.4.3</version>
|
14 |
-
</Aschroder_SMTPPro>
|
15 |
-
</modules>
|
16 |
-
<frontend>
|
17 |
-
<routers>
|
18 |
-
<smtppro>
|
19 |
-
<use>standard</use>
|
20 |
-
<args>
|
21 |
-
<module>Aschroder_SMTPPro</module>
|
22 |
-
<frontName>smtppro</frontName>
|
23 |
-
</args>
|
24 |
-
</smtppro>
|
25 |
-
</routers>
|
26 |
-
</frontend>
|
27 |
-
<global>
|
28 |
-
<helpers>
|
29 |
-
<smtppro><class>Aschroder_SMTPPro_Helper</class></smtppro>
|
30 |
-
</helpers>
|
31 |
-
<blocks>
|
32 |
-
<smtppro>
|
33 |
-
<class>Aschroder_SMTPPro_Block</class>
|
34 |
-
</smtppro>
|
35 |
-
</blocks>
|
36 |
-
<models>
|
37 |
-
<smtppro>
|
38 |
-
<class>Aschroder_SMTPPro_Model</class>
|
39 |
-
<resourceModel>smtppro_mysql4</resourceModel>
|
40 |
-
</smtppro>
|
41 |
-
<smtppro_mysql4>
|
42 |
-
<class>Aschroder_SMTPPro_Model_Mysql4</class>
|
43 |
-
<entities>
|
44 |
-
<email_log><table>smtppro_email_log</table></email_log>
|
45 |
-
</entities>
|
46 |
-
</smtppro_mysql4>
|
47 |
-
<newsletter>
|
48 |
-
<rewrite>
|
49 |
-
<template>Aschroder_SMTPPro_Model_Newsletter_Template</template>
|
50 |
-
</rewrite>
|
51 |
-
</newsletter>
|
52 |
-
<core>
|
53 |
-
<rewrite>
|
54 |
-
<email>Aschroder_SMTPPro_Model_Email</email>
|
55 |
-
<email_template>Aschroder_SMTPPro_Model_Email_Template</email_template>
|
56 |
-
</rewrite>
|
57 |
-
</core>
|
58 |
-
</models>
|
59 |
-
<resources>
|
60 |
-
<smtppro_setup>
|
61 |
-
<setup>
|
62 |
-
<module>Aschroder_SMTPPro</module>
|
63 |
-
<class>Aschroder_SMTPPro_Model_Mysql4_Setup</class>
|
64 |
-
</setup>
|
65 |
-
<connection>
|
66 |
-
<use>core_setup</use>
|
67 |
-
</connection>
|
68 |
-
</smtppro_setup>
|
69 |
-
<smtppro_write>
|
70 |
-
<connection>
|
71 |
-
<use>core_write</use>
|
72 |
-
</connection>
|
73 |
-
</smtppro_write>
|
74 |
-
<smtppro_read>
|
75 |
-
<connection>
|
76 |
-
<use>core_read</use>
|
77 |
-
</connection>
|
78 |
-
</smtppro_read>
|
79 |
-
</resources>
|
80 |
-
<events>
|
81 |
-
<smtppro_email_after_send>
|
82 |
-
<observers>
|
83 |
-
<smtppro_email_after_send_observer>
|
84 |
-
<type>singleton</type>
|
85 |
-
<class>smtppro/observer</class>
|
86 |
-
<method>log</method>
|
87 |
-
</smtppro_email_after_send_observer>
|
88 |
-
</observers>
|
89 |
-
</smtppro_email_after_send>
|
90 |
-
</events>
|
91 |
-
</global>
|
92 |
-
<adminhtml>
|
93 |
-
<menu>
|
94 |
-
<system>
|
95 |
-
<children>
|
96 |
-
<tools>
|
97 |
-
<children>
|
98 |
-
<smtppro translate="title" module="smtppro">
|
99 |
-
<title>Email Log</title>
|
100 |
-
<action>smtppro/log</action>
|
101 |
-
</smtppro>
|
102 |
-
</children>
|
103 |
-
</tools>
|
104 |
-
</children>
|
105 |
-
</system>
|
106 |
-
</menu>
|
107 |
-
<acl>
|
108 |
-
<resources>
|
109 |
-
<admin>
|
110 |
-
<children>
|
111 |
-
<system>
|
112 |
-
<children>
|
113 |
-
<config>
|
114 |
-
<children>
|
115 |
-
<smtppro>
|
116 |
-
<title>SMTP Pro Email Settings</title>
|
117 |
-
</smtppro>
|
118 |
-
</children>
|
119 |
-
</config>
|
120 |
-
</children>
|
121 |
-
</system>
|
122 |
-
</children>
|
123 |
-
</admin>
|
124 |
-
</resources>
|
125 |
-
</acl>
|
126 |
-
<translate>
|
127 |
-
<modules>
|
128 |
-
<Aschroder_SMTPPro>
|
129 |
-
<files>
|
130 |
-
<default>Aschroder_SMTPPro.csv</default>
|
131 |
-
</files>
|
132 |
-
</Aschroder_SMTPPro>
|
133 |
-
</modules>
|
134 |
-
</translate>
|
135 |
-
</adminhtml>
|
136 |
-
<default>
|
137 |
-
<smtppro>
|
138 |
-
<settings>
|
139 |
-
<enabled>0</enabled>
|
140 |
-
<store_addresses>0</store_addresses>
|
141 |
-
<username></username>
|
142 |
-
<password></password>
|
143 |
-
</settings>
|
144 |
-
</smtppro>
|
145 |
-
</default>
|
146 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/etc/system.xml
DELETED
@@ -1,189 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<sections>
|
4 |
-
<system>
|
5 |
-
<groups>
|
6 |
-
<smtppro translate="label comment" module="smtppro">
|
7 |
-
<label>SMTP Pro Email General Settings</label>
|
8 |
-
<frontend_type>text</frontend_type>
|
9 |
-
<sort_order>995</sort_order>
|
10 |
-
<show_in_default>1</show_in_default>
|
11 |
-
<show_in_website>1</show_in_website>
|
12 |
-
<show_in_store>0</show_in_store>
|
13 |
-
<comment>If you are experiencing problems with this extension please run the self diagnosing test by clicking the button below. The module will log what it is doing if you enable logging, this can be useful to determine problems aswell. If you have any questions or would like any help please visit <a href='http://aschroder.com' target='_blank'>ASchroder.com</a>.</comment>
|
14 |
-
<fields>
|
15 |
-
<option translate="label comment">
|
16 |
-
<label>Choose extension option</label>
|
17 |
-
<comment>This will determine which configuration is used; Gmail/Google Apps, SMTP or the new experimental Amazon SES.</comment>
|
18 |
-
<frontend_type>select</frontend_type>
|
19 |
-
<source_model>smtppro/system_config_source_smtp_option</source_model>
|
20 |
-
<sort_order>1</sort_order>
|
21 |
-
<show_in_default>1</show_in_default>
|
22 |
-
<show_in_website>0</show_in_website>
|
23 |
-
<show_in_store>0</show_in_store>
|
24 |
-
</option>
|
25 |
-
<store_addresses translate="label">
|
26 |
-
<label>Use Store Email Addresses for Reply-to</label>
|
27 |
-
<frontend_type>select</frontend_type>
|
28 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
29 |
-
<sort_order>2</sort_order>
|
30 |
-
<show_in_default>1</show_in_default>
|
31 |
-
<show_in_website>0</show_in_website>
|
32 |
-
<show_in_store>0</show_in_store>
|
33 |
-
</store_addresses>
|
34 |
-
<development translate="label comment">
|
35 |
-
<label>Development Mode options</label>
|
36 |
-
<comment>These options can be used during development and testing to control the destination of all emails, or to stop Magento emails sending. (Note: if extensions do not send emails 'the magento way' then they will not be supressed)</comment>
|
37 |
-
<frontend_type>select</frontend_type>
|
38 |
-
<source_model>smtppro/system_config_source_smtp_development</source_model>
|
39 |
-
<sort_order>10</sort_order>
|
40 |
-
<show_in_default>1</show_in_default>
|
41 |
-
<show_in_website>0</show_in_website>
|
42 |
-
<show_in_store>0</show_in_store>
|
43 |
-
</development>
|
44 |
-
<logenabled translate="label comment">
|
45 |
-
<label>Log all messages</label>
|
46 |
-
<comment>This will log all outbound emails to the table smtppro_email_log and allow viewing within the admin interface from System->Tools->Email Log.</comment>
|
47 |
-
<frontend_type>select</frontend_type>
|
48 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
-
<sort_order>16</sort_order>
|
50 |
-
<show_in_default>1</show_in_default>
|
51 |
-
<show_in_website>0</show_in_website>
|
52 |
-
<show_in_store>0</show_in_store>
|
53 |
-
</logenabled>
|
54 |
-
<test translate="label comment">
|
55 |
-
<comment>This test will ensure the configuration in your Google Apps/ Gmail OR SMTP section are working. You have to save the settings from either of these sections before running this test.</comment>
|
56 |
-
<frontend_type>select</frontend_type>
|
57 |
-
<frontend_model>Aschroder_SMTPPro_Block_Adminhtml_Test</frontend_model>
|
58 |
-
<sort_order>20</sort_order>
|
59 |
-
<show_in_default>1</show_in_default>
|
60 |
-
<show_in_website>0</show_in_website>
|
61 |
-
<show_in_store>0</show_in_store>
|
62 |
-
</test>
|
63 |
-
</fields>
|
64 |
-
</smtppro>
|
65 |
-
<googlesettings translate="label" module="smtppro">
|
66 |
-
<label>SMTP Pro Email Google Apps/Gmail Settings</label>
|
67 |
-
<frontend_type>text</frontend_type>
|
68 |
-
<sort_order>996</sort_order>
|
69 |
-
<show_in_default>1</show_in_default>
|
70 |
-
<show_in_website>1</show_in_website>
|
71 |
-
<show_in_store>0</show_in_store>
|
72 |
-
<comment></comment>
|
73 |
-
<fields>
|
74 |
-
<email translate="label">
|
75 |
-
<label>Email Address</label>
|
76 |
-
<frontend_type>text</frontend_type>
|
77 |
-
<sort_order>5</sort_order>
|
78 |
-
<show_in_default>1</show_in_default>
|
79 |
-
<show_in_website>1</show_in_website>
|
80 |
-
<show_in_store>0</show_in_store>
|
81 |
-
</email>
|
82 |
-
<gpassword translate="label">
|
83 |
-
<label>Password</label>
|
84 |
-
<frontend_type>password</frontend_type>
|
85 |
-
<sort_order>10</sort_order>
|
86 |
-
<show_in_default>1</show_in_default>
|
87 |
-
<show_in_website>1</show_in_website>
|
88 |
-
<show_in_store>0</show_in_store>
|
89 |
-
</gpassword>
|
90 |
-
</fields>
|
91 |
-
</googlesettings>
|
92 |
-
<smtpsettings translate="label" module="smtppro">
|
93 |
-
<label>SMTP Pro Email SMTP Settings</label>
|
94 |
-
<frontend_type>text</frontend_type>
|
95 |
-
<sort_order>997</sort_order>
|
96 |
-
<show_in_default>1</show_in_default>
|
97 |
-
<show_in_website>1</show_in_website>
|
98 |
-
<show_in_store>0</show_in_store>
|
99 |
-
<comment></comment>
|
100 |
-
<fields>
|
101 |
-
<authentication translate="label comment">
|
102 |
-
<label>Authentication</label>
|
103 |
-
<comment>This will determine if and how you authenticate with your SMTP server. If you choose no authentication then the username and password below are not used.</comment>
|
104 |
-
<frontend_type>select</frontend_type>
|
105 |
-
<source_model>smtppro/system_config_source_smtp_authentication</source_model>
|
106 |
-
<sort_order>4</sort_order>
|
107 |
-
<show_in_default>1</show_in_default>
|
108 |
-
<show_in_website>1</show_in_website>
|
109 |
-
<show_in_store>0</show_in_store>
|
110 |
-
</authentication>
|
111 |
-
<username translate="label comment">
|
112 |
-
<comment>If you use Authentication for your SMTP server this is the username used to authenticate.</comment>
|
113 |
-
<label>Username</label>
|
114 |
-
<frontend_type>text</frontend_type>
|
115 |
-
<sort_order>5</sort_order>
|
116 |
-
<show_in_default>1</show_in_default>
|
117 |
-
<show_in_website>1</show_in_website>
|
118 |
-
<show_in_store>0</show_in_store>
|
119 |
-
</username>
|
120 |
-
<password translate="label comment">
|
121 |
-
<comment>If you use Authentication for your SMTP server this is the password used to authenticate.</comment>
|
122 |
-
<label>Password</label>
|
123 |
-
<frontend_type>password</frontend_type>
|
124 |
-
<sort_order>10</sort_order>
|
125 |
-
<show_in_default>1</show_in_default>
|
126 |
-
<show_in_website>1</show_in_website>
|
127 |
-
<show_in_store>0</show_in_store>
|
128 |
-
</password>
|
129 |
-
<host translate="label comment">
|
130 |
-
<comment>This is the SMTP server hostname you would like to send your emails through. This is required.</comment>
|
131 |
-
<label>Host</label>
|
132 |
-
<frontend_type>text</frontend_type>
|
133 |
-
<sort_order>14</sort_order>
|
134 |
-
<show_in_default>1</show_in_default>
|
135 |
-
<show_in_website>1</show_in_website>
|
136 |
-
<show_in_store>0</show_in_store>
|
137 |
-
</host>
|
138 |
-
<port translate="label comment">
|
139 |
-
<comment>This is the port on the SMTP server you connect to. The value is optional, it defaults to 25 for none and TLS or 465 for SSL.</comment>
|
140 |
-
<label>Port</label>
|
141 |
-
<frontend_type>text</frontend_type>
|
142 |
-
<sort_order>16</sort_order>
|
143 |
-
<show_in_default>1</show_in_default>
|
144 |
-
<show_in_website>1</show_in_website>
|
145 |
-
<show_in_store>0</show_in_store>
|
146 |
-
</port>
|
147 |
-
<ssl translate="label comment">
|
148 |
-
<label>SSL Security</label>
|
149 |
-
<comment>This will determine if any SSL security should be used to connect to your SMTP server.</comment>
|
150 |
-
<frontend_type>select</frontend_type>
|
151 |
-
<source_model>smtppro/system_config_source_smtp_ssl</source_model>
|
152 |
-
<sort_order>19</sort_order>
|
153 |
-
<show_in_default>1</show_in_default>
|
154 |
-
<show_in_website>1</show_in_website>
|
155 |
-
<show_in_store>0</show_in_store>
|
156 |
-
</ssl>
|
157 |
-
</fields>
|
158 |
-
</smtpsettings>
|
159 |
-
<sessettings translate="label" module="smtppro">
|
160 |
-
<label>SMTP Pro Email Amazon SES Settings (experimental)</label>
|
161 |
-
<frontend_type>text</frontend_type>
|
162 |
-
<sort_order>998</sort_order>
|
163 |
-
<show_in_default>1</show_in_default>
|
164 |
-
<show_in_website>1</show_in_website>
|
165 |
-
<show_in_store>0</show_in_store>
|
166 |
-
<comment>These settings are for experimental use of the Amazon AWS SES service. This should not be used on a production server yet, but please do try it out and let me know how you get on.</comment>
|
167 |
-
<fields>
|
168 |
-
<aws_access_key translate="label">
|
169 |
-
<label>Access Key</label>
|
170 |
-
<frontend_type>text</frontend_type>
|
171 |
-
<sort_order>5</sort_order>
|
172 |
-
<show_in_default>1</show_in_default>
|
173 |
-
<show_in_website>1</show_in_website>
|
174 |
-
<show_in_store>0</show_in_store>
|
175 |
-
</aws_access_key>
|
176 |
-
<aws_private_key translate="label">
|
177 |
-
<label>Secret Key</label>
|
178 |
-
<frontend_type>password</frontend_type>
|
179 |
-
<sort_order>10</sort_order>
|
180 |
-
<show_in_default>1</show_in_default>
|
181 |
-
<show_in_website>1</show_in_website>
|
182 |
-
<show_in_store>0</show_in_store>
|
183 |
-
</aws_private_key>
|
184 |
-
</fields>
|
185 |
-
</sessettings>
|
186 |
-
</groups>
|
187 |
-
</system>
|
188 |
-
</sections>
|
189 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/locale/de_DE/Aschroder_SMTPPro.csv
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
"SMTP Pro Email General Settings","SMTP Pro Email - Grundlegende Einstellungen"
|
2 |
-
"If you are experiencing problems with this extension please run the self diagnosing test by clicking the button below. The module will log what it is doing if you enable logging, this can be useful to determine problems aswell. If you have any questions or would like any help please visit <a href='http://aschroder.com' target='_blank'>ASchroder.com</a>.","Wenn Probleme mit dieser Erweiterung auftreten, starten Sie den Selbsttest durch Klick auf den Knopf unten. Das Modul wird alle Vorgänge protokollieren, wenn das Logging aktiviert ist, dies kann ebenfalls zum Aufdecken von Problemen genutzt werden. Sollten Sie Fragen haben oder wünschen sich Hilfe, so besuchen Sie bitte <a href='http://aschroder.com' target='_blank'>ASchroder.com</a>. "
|
3 |
-
"Choose extension option","Wählen Sie eine Versandoption"
|
4 |
-
"This will determine if the extension uses the simple Google Apps/Gmail configuration, The advanced SMTP configuration or disables the extension completely.","Dies entscheidet, ob die Google-Apps/Gmail-Konfiguration oder die erweiterte Konfiguration verwendet oder die Erweiterung komplett deaktiviert werden soll."
|
5 |
-
"Use Store Email Addresses for Reply-to","Store-E-Mail-Adressen für Antwort-an-Header verwenden"
|
6 |
-
"Development Mode options","Entwicklermodus"
|
7 |
-
"Development Mode disabled","Entwicklermodus deaktiviert"
|
8 |
-
"Redirect to contact form email","Auf Kontaktformular-Adresse weiterleiten"
|
9 |
-
"Supress all emails","Alle E-Mails unterdrücken"
|
10 |
-
"These options can be used during development and testing to control the destination of all emails, or to stop Magento emails sending. (Note: if extensions do not send emails 'the magento way' then they will not be supressed)","Diese Optionen können während Entwicklung und Testphase genutzt werden, um das Mail-Ziel zu steuern oder alle Magento-E-Mails abzufangen. (Hinweis: Wenn eine Erweiterung Mails am Magento-Standard vorbei sendet, können sie nicht beeinflusst werden)"
|
11 |
-
"Log all messages","Alle Nachrichten protokollieren"
|
12 |
-
"Email Log","E-Mail-Protokoll"
|
13 |
-
"This will log all outbound emails to the table smtppro_email_log and allow viewing within the admin interface from System->Tools->Email Log.","Dies wird alle ausgehenden E-Mails in der Tabelle smtppro_email_log protokollieren. Das Protokoll kann im Backend unter System->Werkzeuge->E-Mail-Protokoll eingesehen werden."
|
14 |
-
"Run Self Test","Selbsttest durchführen"
|
15 |
-
"This test will ensure the configuration in your Google Apps/ Gmail OR SMTP section are working. You have to save the settings from either of these sections before running this test.","Dieser Test wird sicherstellen, dass die Konfiguration im Google-Apps/Gmail- oder SMTP-Abschnitt korrekt ist. Vor dem Test müssen die Einstellungen in diesen Abschnitten gespeichert werden."
|
16 |
-
"SMTP Pro Email Google Apps/Gmail Settings","SMTP Pro Email - Google-Apps/Gmail-Einstellungen"
|
17 |
-
"SMTP Pro Email SMTP Settings","SMTP Pro Email - SMTP-Einstellungen"
|
18 |
-
"Authentication","Authentifizierung"
|
19 |
-
"None (ignore username/password)","Keine (ignoriere Benutzername/Passwort)"
|
20 |
-
"This will determine if and how you authenticate with your SMTP server. If you choose no authentication then the username and password below are not used.","Dies legt fest, ob und wie die Authentifizierung am SMTP-Server erfolgen soll. Entfällt die Authentifizierung, werden die Felder für Benutzername und Passwort nicht genutzt."
|
21 |
-
"Username","Benutzername"
|
22 |
-
"If you use Authentication for your SMTP server this is the username used to authenticate.","Bei Verwendung von Authentifizierung am SMTP-Server wird dieser Benutzername zur Anmeldung verwendet"
|
23 |
-
"If you use Authentication for your SMTP server this is the password used to authenticate.","Bei Verwendung von Authentifizierung am SMTP-Server wird dieses Passwort zur Anmeldung verwendet"
|
24 |
-
"This is the SMTP server hostname you would like to send your emails through. This is required.","Der Hostname des SMTP-Servers, über den die E-Mails verschickt werden sollen. Dies ist ein Pflichtfeld"
|
25 |
-
"This is the port on the SMTP server you connect to. The value is optional, it defaults to 25 for none and TLS or 465 for SSL.","Der Port über den der SMTP-Server erreicht werden soll. Dieser Wert ist optional, ohne Angabe wird Port 25 ohne Verschlüsselung oder mit TLS, Port 465 für SSL verwendet"
|
26 |
-
"SSL Security","SSL-Sicherheit"
|
27 |
-
"No SSL","Kein SSL"
|
28 |
-
"This will determine if any SSL security should be used to connect to your SMTP server.","Dies gibt an, welche SSL-Sicherheit für die Verbindung zum SMTP-Server verwendet werden soll."TP server you connect to. The value is optional, it defaults to 25 for none and TLS or 465 for SSL.","Der Port über den der SMTP-Server erreicht werden soll. Dieser Wert ist optional, ohne Angabe wird Port 25 ohne Verschlüsselung oder mit TLS, Port 465 für SSL verwendet"
|
29 |
-
"SSL Security","SSL-Sicherheit"
|
30 |
-
"No SSL","Kein SSL"
|
31 |
-
"This will determine if any SSL security should be used to connect to your SMTP server.","Dies gibt an, welche SSL-Sicherheit für die Verbindung zum SMTP-Server verwe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/modules/Aschroder_SMTPPro.xml
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Aschroder_SMTPPro>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Aschroder_SMTPPro>
|
8 |
-
</modules>
|
9 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @author Ashley Schroder (aschroder.com)
|
6 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
|
10 |
-
|
11 |
-
$installer = $this;
|
12 |
-
|
13 |
-
$installer->startSetup();
|
14 |
-
|
15 |
-
Mage::log("Running installer");
|
16 |
-
|
17 |
-
$installer->run("
|
18 |
-
CREATE TABLE `{$this->getTable('smtppro_email_log')}` (
|
19 |
-
`email_id` int(10) unsigned NOT NULL auto_increment,
|
20 |
-
`log_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
21 |
-
`to` varchar(255) NOT NULL default '',
|
22 |
-
`template` varchar(255) NULL,
|
23 |
-
`subject` varchar(255) NULL,
|
24 |
-
`email_body` text,
|
25 |
-
PRIMARY KEY (`email_id`),
|
26 |
-
KEY `log_at` (`log_at`)
|
27 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
-
");
|
29 |
-
|
30 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Aschroder/SMTPPro/templates/adminhtml/base/default/template/smtppro/view.phtml
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @author Ashley Schroder (aschroder.com)
|
6 |
-
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<?php if($email = $this->getEmailData()): ?>
|
11 |
-
<div class="page-head">
|
12 |
-
<h3><?php echo $this->__('Email Details') ?></h3>
|
13 |
-
</div>
|
14 |
-
<div class="email-detail">
|
15 |
-
<p><strong><?php echo $this->__('To:') ?></strong> <?php echo $email->getTo(); ?></p>
|
16 |
-
<p><strong><?php echo $this->__('Subject:') ?></strong> <?php echo $email->getSubject(); ?></p>
|
17 |
-
<p><strong><?php echo $this->__('Template:') ?></strong> <?php echo $email->getTemplate(); ?></p>
|
18 |
-
<p><strong><?php echo $this->__('Sent:') ?></strong> <?php echo $email->getLogAt(); ?></p>
|
19 |
-
<p><strong><?php echo $this->__('Message:') ?></strong></p>
|
20 |
-
<div>
|
21 |
-
<?php echo $email->getEmailBody(); ?>
|
22 |
-
</div>
|
23 |
-
|
24 |
-
</div>
|
25 |
-
<br/>
|
26 |
-
<div class="button-set"><a href="<?php echo $this->getBackUrl() ?>" class="left">« <?php echo $this->__('Back to Email Log') ?></a></div><br />
|
27 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Table.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This is the Email Service Table
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Aschroder_SMTPPro_Block_Adminhtml_Table
|
12 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
13 |
+
|
14 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
15 |
+
// This is included dynamically so it can be updated from time to time without the need for extension updates.
|
16 |
+
$html = '<iframe src="http://www.aschroder.com/esptable.html" style="border: none; height: 1000px; width: 100%;"></iframe>';
|
17 |
+
return '<tr>' . $html . '</tr>';
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Test.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This is the Self test Button
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Aschroder_SMTPPro_Block_Adminhtml_Test
|
12 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
13 |
+
{
|
14 |
+
|
15 |
+
|
16 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
17 |
+
{
|
18 |
+
$this->setElement($element);
|
19 |
+
$buttonHtml = $this->_getAddRowButtonHtml($this->__('Run Self Test'));
|
20 |
+
return $buttonHtml;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
protected function _getAddRowButtonHtml($title)
|
25 |
+
{
|
26 |
+
|
27 |
+
$buttonBlock = $this->getElement()->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
|
28 |
+
|
29 |
+
$_websiteCode = $buttonBlock->getRequest()->getParam('website', null);
|
30 |
+
|
31 |
+
$params = array();
|
32 |
+
|
33 |
+
if(!empty($_websiteCode)) {
|
34 |
+
$params['website'] = $_websiteCode;
|
35 |
+
}
|
36 |
+
|
37 |
+
// TODO: for real multi-store self-testing, the test button (and other configuration options)
|
38 |
+
// should probably be set to show in website. Currently they are not.
|
39 |
+
$url = $this->getUrl("smtppro/test/index", $params);
|
40 |
+
|
41 |
+
$buttonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
+
->setType('button')
|
43 |
+
->setLabel($this->__($title))
|
44 |
+
->setOnClick("window.location.href='".$url."'")
|
45 |
+
->toHtml();
|
46 |
+
|
47 |
+
return $buttonHtml;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/Block/Log.php
RENAMED
File without changes
|
app/code/{community → local}/Aschroder/SMTPPro/Block/Log/Grid.php
RENAMED
@@ -14,7 +14,7 @@ class Aschroder_SMTPPro_Block_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
|
14 |
parent::__construct();
|
15 |
$this->setId('emailLogGrid');
|
16 |
$this->setDefaultSort('email_id');
|
17 |
-
|
18 |
}
|
19 |
|
20 |
protected function _prepareCollection()
|
@@ -44,10 +44,10 @@ class Aschroder_SMTPPro_Block_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
|
44 |
'width' => '160px',
|
45 |
'index' => 'subject',
|
46 |
));
|
47 |
-
$this->addColumn('
|
48 |
'header' => Mage::helper('adminhtml')->__('To'),
|
49 |
'width' => '160px',
|
50 |
-
'index' => '
|
51 |
));
|
52 |
|
53 |
|
14 |
parent::__construct();
|
15 |
$this->setId('emailLogGrid');
|
16 |
$this->setDefaultSort('email_id');
|
17 |
+
$this->setDefaultDir('DESC');
|
18 |
}
|
19 |
|
20 |
protected function _prepareCollection()
|
44 |
'width' => '160px',
|
45 |
'index' => 'subject',
|
46 |
));
|
47 |
+
$this->addColumn('email_to', array(
|
48 |
'header' => Mage::helper('adminhtml')->__('To'),
|
49 |
'width' => '160px',
|
50 |
+
'index' => 'email_to',
|
51 |
));
|
52 |
|
53 |
|
app/code/{community → local}/Aschroder/SMTPPro/Block/Log/View.php
RENAMED
File without changes
|
app/code/local/Aschroder/SMTPPro/Helper/Data.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Various Helper functions for the Aschroder.com SMTP Pro module.
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @author Ashley Schroder (aschroder.com)
|
8 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Aschroder_SMTPPro_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
+
{
|
14 |
+
|
15 |
+
const LOG_FILE = 'aschroder_smtppro.log';
|
16 |
+
|
17 |
+
public function getTransport($storeId = null)
|
18 |
+
{
|
19 |
+
|
20 |
+
$option = Mage::getStoreConfig('smtppro/general/option', $storeId);
|
21 |
+
return Mage::getModel("smtppro/transports_$option")->getTransport($storeId);
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
public function log($m)
|
26 |
+
{
|
27 |
+
if ($this->isDebugLoggingEnabled()) {
|
28 |
+
Mage::log($m, null, self::LOG_FILE);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function logEmailSent($to, $template, $subject, $email, $isHtml)
|
33 |
+
{
|
34 |
+
if ($this->isLogEnabled()) {
|
35 |
+
$log = Mage::getModel('smtppro/email_log')
|
36 |
+
->setEmailTo($to)
|
37 |
+
->setTemplate($template)
|
38 |
+
->setSubject($subject)
|
39 |
+
->setEmailBody($isHtml ? $email : nl2br($email))
|
40 |
+
->save();
|
41 |
+
}
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
// General config
|
46 |
+
public function isEnabled($storeId = null)
|
47 |
+
{
|
48 |
+
return Mage::getStoreConfig('smtppro/general/option', $storeId) != "disabled";
|
49 |
+
}
|
50 |
+
|
51 |
+
public function isGoogleAppsEnabled($storeId = null)
|
52 |
+
{
|
53 |
+
return Mage::getStoreConfig('smtppro/general/option', $storeId) == "google";
|
54 |
+
}
|
55 |
+
|
56 |
+
public function isAmazonSESEnabled($storeId = null)
|
57 |
+
{
|
58 |
+
return Mage::getStoreConfig('smtppro/general/option', $storeId) == "ses";
|
59 |
+
}
|
60 |
+
|
61 |
+
public function isSMTPEnabled($storeId = null)
|
62 |
+
{
|
63 |
+
return Mage::getStoreConfig('smtppro/general/option', $storeId) == "smtp";
|
64 |
+
}
|
65 |
+
|
66 |
+
public function isSendGridEnabled($storeId = null)
|
67 |
+
{
|
68 |
+
return Mage::getStoreConfig('smtppro/general/option', $storeId) == "sendgrid";
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
// logging config
|
73 |
+
public function isLogCleaningEnabled($storeId = null)
|
74 |
+
{
|
75 |
+
return Mage::getStoreConfigFlag('smtppro/debug/cleanlog', $storeId);
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getLogLifetimeDays($storeId = null)
|
79 |
+
{
|
80 |
+
return Mage::getStoreConfig('smtppro/debug/cleanlog_after_days', $storeId);
|
81 |
+
}
|
82 |
+
|
83 |
+
public function isLogEnabled($storeId = null)
|
84 |
+
{
|
85 |
+
return Mage::getStoreConfigFlag('smtppro/debug/logenabled', $storeId);
|
86 |
+
}
|
87 |
+
|
88 |
+
public function isDebugLoggingEnabled($storeId = null)
|
89 |
+
{
|
90 |
+
return Mage::getStoreConfigFlag('smtppro/debug/log_debug', $storeId);
|
91 |
+
}
|
92 |
+
|
93 |
+
// transport config
|
94 |
+
public function getAmazonSESAccessKey($storeId = null)
|
95 |
+
{
|
96 |
+
return Mage::getStoreConfig('smtppro/general/ses_access_key', $storeId);
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getAmazonSESPrivateKey($storeId = null)
|
100 |
+
{
|
101 |
+
return Mage::getStoreConfig('smtppro/general/ses_private_key', $storeId);
|
102 |
+
}
|
103 |
+
|
104 |
+
public function getGoogleAppsEmail($storeId = null)
|
105 |
+
{
|
106 |
+
return Mage::getStoreConfig('smtppro/general/googleapps_email', $storeId);
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getGoogleAppsPassword($storeId = null)
|
110 |
+
{
|
111 |
+
return Mage::getStoreConfig('smtppro/general/googleapps_gpassword', $storeId);
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
public function getSendGridEmail($storeId = null)
|
116 |
+
{
|
117 |
+
return Mage::getStoreConfig('smtppro/general/sendgrid_email', $storeId);
|
118 |
+
}
|
119 |
+
|
120 |
+
public function getSendGridPassword($storeId = null)
|
121 |
+
{
|
122 |
+
return Mage::getStoreConfig('smtppro/general/sendgrid_password', $storeId);
|
123 |
+
}
|
124 |
+
|
125 |
+
public function getSMTPSettingsHost($storeId = null)
|
126 |
+
{
|
127 |
+
return Mage::getStoreConfig('smtppro/general/smtp_host', $storeId);
|
128 |
+
}
|
129 |
+
|
130 |
+
public function getSMTPSettingsPort($storeId = null)
|
131 |
+
{
|
132 |
+
return Mage::getStoreConfig('smtppro/general/smtp_port', $storeId);
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getSMTPSettingsUsername($storeId = null)
|
136 |
+
{
|
137 |
+
return Mage::getStoreConfig('smtppro/general/smtp_username', $storeId);
|
138 |
+
}
|
139 |
+
|
140 |
+
public function getSMTPSettingsPassword($storeId = null)
|
141 |
+
{
|
142 |
+
return Mage::getStoreConfig('smtppro/general/smtp_password', $storeId);
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getSMTPSettingsSSL($storeId = null)
|
146 |
+
{
|
147 |
+
return Mage::getStoreConfig('smtppro/general/smtp_ssl', $storeId);
|
148 |
+
}
|
149 |
+
|
150 |
+
public function getSMTPSettingsAuthentication($storeId = null)
|
151 |
+
{
|
152 |
+
return Mage::getStoreConfig('smtppro/general/smtp_authentication', $storeId);
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
// These are not the droids you're looking for...
|
157 |
+
|
158 |
+
// Keeping this function for backward compatibility
|
159 |
+
// It will be dropped eventually so call getTransport() from now on!
|
160 |
+
public function getSMTPProTransport($id = null)
|
161 |
+
{
|
162 |
+
return $this->getTransport($id);
|
163 |
+
}
|
164 |
+
|
165 |
+
// Keeping this function for backward compatibility
|
166 |
+
// It will be dropped eventually so call getTransport() from now on!
|
167 |
+
public function getGoogleAppsEmailTransport($id = null)
|
168 |
+
{
|
169 |
+
return $this->getTransport($id);
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
app/code/local/Aschroder/SMTPPro/Helper/Mysql4/Install.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Installation helper to make installs more consistent, trackable, repeatable and debugable.
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @author Jay El-Kaake
|
8 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Aschroder_SMTPPro_Helper_Mysql4_Install extends Mage_Core_Helper_Abstract
|
13 |
+
{
|
14 |
+
|
15 |
+
protected $ex_stack = array ();
|
16 |
+
|
17 |
+
protected $_setup = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* alter table for each column update and ignore duplicate column errors
|
21 |
+
* This is used since "if column not exists" function does not exist
|
22 |
+
* for MYSQL
|
23 |
+
*
|
24 |
+
* @param unknown_type $installer
|
25 |
+
* @param string $table_name
|
26 |
+
* @param array $columns
|
27 |
+
* @return Aschroder_SMTPPro_Helper_Mysql4_Install
|
28 |
+
*/
|
29 |
+
public function addColumns(&$installer, $table_name, $columns)
|
30 |
+
{
|
31 |
+
foreach($columns as $column) {
|
32 |
+
$sql = "ALTER TABLE {$table_name} ADD COLUMN({$column});";
|
33 |
+
// run SQL and ignore any errors including (Duplicate column errors)
|
34 |
+
try {
|
35 |
+
$installer->run($sql);
|
36 |
+
} catch(Exception $ex) {
|
37 |
+
$this->addInstallProblem($ex);
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Attempt to add a foreign key constraint on two tables
|
45 |
+
*
|
46 |
+
* @param unknown_type $installer
|
47 |
+
* @param string $table1_name
|
48 |
+
* @param string $column1
|
49 |
+
* @param string $table2_name
|
50 |
+
* @param string $column2=null (uses column1 if null)
|
51 |
+
* @param string $on_delete='CASCADE'
|
52 |
+
* @param string $on_update='NO ACTION'
|
53 |
+
* @return Aschroder_SMTPPro_Helper_Mysql4_Install
|
54 |
+
*/
|
55 |
+
public function addFKey(&$installer, $key_name, $table1_name, $column1, $table2_name, $column2=null, $on_delete='NO ACTION', $on_update='NO ACTION')
|
56 |
+
{
|
57 |
+
try {
|
58 |
+
if(empty($column2)) {
|
59 |
+
$column2 = $column1;
|
60 |
+
}
|
61 |
+
$installer->getConnection()
|
62 |
+
->addConstraint(
|
63 |
+
$key_name,
|
64 |
+
$table1_name,
|
65 |
+
$column1,
|
66 |
+
$table2_name,
|
67 |
+
$column2,
|
68 |
+
$on_delete,
|
69 |
+
$on_update
|
70 |
+
);
|
71 |
+
} catch(Exception $ex) {
|
72 |
+
$this->addInstallProblem($ex);
|
73 |
+
}
|
74 |
+
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Adds an exception problem to the stack of problems that may
|
80 |
+
* have occured during installation.
|
81 |
+
* Ignores duplicate column name errors; ignore if the msg starts with "SQLSTATE[42S21]: Column already exists"
|
82 |
+
* @param Exception $ex
|
83 |
+
*/
|
84 |
+
public function addInstallProblem(Exception $ex)
|
85 |
+
{
|
86 |
+
if (strpos($ex->getMessage (), "SQLSTATE[42S21]: Column already exists") !== false)
|
87 |
+
return $this;
|
88 |
+
if (strpos($ex->getMessage (), "SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP") !== false
|
89 |
+
&& strpos($ex->getMessage (), "check that column/key exists") !== false )
|
90 |
+
return $this;
|
91 |
+
$this->ex_stack [] = $ex;
|
92 |
+
return $this;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Returns true if any problems occured after installation
|
97 |
+
* @return boolean
|
98 |
+
*/
|
99 |
+
public function hasProblems()
|
100 |
+
{
|
101 |
+
return sizeof($this->ex_stack ) > 0;
|
102 |
+
}
|
103 |
+
/**
|
104 |
+
* Returns a string of problems that occured after any installation scripts were run through this helper
|
105 |
+
* @return string message to display to the user
|
106 |
+
*/
|
107 |
+
public function getProblemsString()
|
108 |
+
{
|
109 |
+
$msg = $this->__("The following errors occured while trying to install the module.");
|
110 |
+
$msg .= "\n<br>";
|
111 |
+
foreach($this->ex_stack as $ex_i => $ex) {
|
112 |
+
$msg .= "<b>#{$ex_i}: </b>";
|
113 |
+
if(Mage::getIsDeveloperMode()) {
|
114 |
+
$msg .= nl2br($ex);
|
115 |
+
} else {
|
116 |
+
$msg .= $ex->getMessage ();
|
117 |
+
}
|
118 |
+
$msg .= "\n<br>";
|
119 |
+
}
|
120 |
+
$msg .= "\n<br>";
|
121 |
+
$msg .= $this->__("If any of these problems were unexpected, I recommend that you contact the module support team to avoid problems in the future.");
|
122 |
+
return $msg;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Clears any insall problems (exceptions) that were in the stack
|
127 |
+
*/
|
128 |
+
public function clearProblems()
|
129 |
+
{
|
130 |
+
$this->ex_stack = array ();
|
131 |
+
return $this;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* alter table for each column update and ignore duplicate column errors
|
136 |
+
* This is used since "if column not exists" function does not exist
|
137 |
+
* for MYSQL
|
138 |
+
*
|
139 |
+
* @param unknown_type $installer
|
140 |
+
* @param string $table_name
|
141 |
+
* @param array $columns
|
142 |
+
* @return Aschroder_SMTPPro_Helper_Mysql4_Install
|
143 |
+
*/
|
144 |
+
public function dropColumns(&$installer, $table_name, $columns)
|
145 |
+
{
|
146 |
+
foreach($columns as $column) {
|
147 |
+
$sql = "ALTER TABLE {$table_name} DROP COLUMN {$column} ;";
|
148 |
+
// run SQL and ignore any errors including (Duplicate column errors)
|
149 |
+
try {
|
150 |
+
$installer->run($sql);
|
151 |
+
} catch(Exception $ex) {
|
152 |
+
$this->addInstallProblem($ex);
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
return $this;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Runs a SQL query using the install resource provided and
|
161 |
+
* remembers any errors that occur.
|
162 |
+
*
|
163 |
+
* @param unknown_type $installer
|
164 |
+
* @param string $sql
|
165 |
+
* @return Aschroder_SMTPPro_Helper_Mysql4_Install
|
166 |
+
*/
|
167 |
+
public function attemptQuery(&$installer, $sql)
|
168 |
+
{
|
169 |
+
try {
|
170 |
+
$installer->run($sql);
|
171 |
+
} catch(Exception $ex) {
|
172 |
+
$this->addInstallProblem($ex);
|
173 |
+
}
|
174 |
+
return $this;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Creates an installation message notice in the backend.
|
179 |
+
* @param string $msg_title
|
180 |
+
* @param string $msg_desc
|
181 |
+
* @param string $url=null if null default URL is used.
|
182 |
+
*/
|
183 |
+
public function createInstallNotice($msg_title, $msg_desc, $url = null, $severity = null)
|
184 |
+
{
|
185 |
+
$message = Mage::getModel('adminnotification/inbox');
|
186 |
+
$message->setDateAdded(date("c", time () ));
|
187 |
+
|
188 |
+
if ($url == null) {
|
189 |
+
$url = "https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension";
|
190 |
+
}
|
191 |
+
|
192 |
+
if ($severity === null) {
|
193 |
+
$severity = Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE;
|
194 |
+
}
|
195 |
+
|
196 |
+
// If problems occured increase severity and append logged messages.
|
197 |
+
if (Mage::helper('smtppro/mysql4_install' )->hasProblems ()) {
|
198 |
+
$severity = Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR;
|
199 |
+
$msg_title .= " Problems may have occured during installation.";
|
200 |
+
$msg_desc .= " " . Mage::helper('smtppro/mysql4_install' )->getProblemsString ();
|
201 |
+
Mage::helper('smtppro/mysql4_install' )->clearProblems ();
|
202 |
+
}
|
203 |
+
|
204 |
+
$message->setTitle($msg_title);
|
205 |
+
$message->setDescription($msg_desc);
|
206 |
+
$message->setUrl($url);
|
207 |
+
$message->setSeverity($severity);
|
208 |
+
$message->save ();
|
209 |
+
|
210 |
+
return $this;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Add an EAV entity attribute to the database.
|
215 |
+
*
|
216 |
+
* @param string $entity_type entity type (catalog_product, order, order_item, etc)
|
217 |
+
* @param string $attribute_code attribute code
|
218 |
+
* @param array $data eav attribute data
|
219 |
+
*/
|
220 |
+
public function addAttribute($entity_type, $attribute_code, $data)
|
221 |
+
{
|
222 |
+
try {
|
223 |
+
$this->_getSetupSingleton ()->addAttribute($entity_type, $attribute_code, $data);
|
224 |
+
} catch(Exception $ex) {
|
225 |
+
$this->addInstallProblem($ex);
|
226 |
+
}
|
227 |
+
return $this;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Clears cache and prepares anything that needs to generally happen before running DB install scripts.
|
232 |
+
*/
|
233 |
+
public function prepareForDb()
|
234 |
+
{
|
235 |
+
|
236 |
+
try {
|
237 |
+
Mage::app()->getCacheInstance()->flush();
|
238 |
+
|
239 |
+
} catch(Exception $ex) {
|
240 |
+
$this->addInstallProblem("Problem clearing cache:". $ex);
|
241 |
+
}
|
242 |
+
|
243 |
+
return $this;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* @return Mage_Eav_Model_Entity_Setup
|
248 |
+
*/
|
249 |
+
protected function _getSetupSingleton() {
|
250 |
+
if ($this->_setup == null) {
|
251 |
+
$this->_setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
252 |
+
}
|
253 |
+
return $this->_setup;
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Email.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This class wraps the Basic email sending functionality
|
4 |
+
* If SMTPPro is enabled it will send emails using the given
|
5 |
+
* configuration.
|
6 |
+
*
|
7 |
+
* @author Ashley Schroder (aschroder.com)
|
8 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Aschroder_SMTPPro_Model_Email extends Mage_Core_Model_Email {
|
13 |
+
|
14 |
+
|
15 |
+
public function send() {
|
16 |
+
|
17 |
+
$_helper = Mage::helper('smtppro');
|
18 |
+
|
19 |
+
// If it's not enabled, just return the parent result.
|
20 |
+
if (!$_helper->isEnabled()) {
|
21 |
+
return parent::send();
|
22 |
+
}
|
23 |
+
|
24 |
+
if (Mage::getStoreConfigFlag('system/smtp/disable')) {
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
$mail = new Zend_Mail();
|
29 |
+
|
30 |
+
if (strtolower($this->getType()) == 'html') {
|
31 |
+
$mail->setBodyHtml($this->getBody());
|
32 |
+
} else {
|
33 |
+
$mail->setBodyText($this->getBody());
|
34 |
+
}
|
35 |
+
|
36 |
+
$mail->setFrom($this->getFromEmail(), $this->getFromName())
|
37 |
+
->addTo($this->getToEmail(), $this->getToName())
|
38 |
+
->setSubject($this->getSubject());
|
39 |
+
|
40 |
+
$transport = new Varien_Object(); // for observers to set if required
|
41 |
+
Mage::dispatchEvent('aschroder_smtppro_before_send', array(
|
42 |
+
'mail' => $mail,
|
43 |
+
'email' => $this,
|
44 |
+
'transport' => $transport
|
45 |
+
));
|
46 |
+
|
47 |
+
if ($transport->getTransport()) { // if set by an observer, use it
|
48 |
+
$mail->send($transport->getTransport());
|
49 |
+
} else {
|
50 |
+
$mail->send();
|
51 |
+
}
|
52 |
+
|
53 |
+
Mage::dispatchEvent('aschroder_smtppro_after_send', array(
|
54 |
+
'to' => $this->getToName(),
|
55 |
+
'subject' => $this->getSubject(),
|
56 |
+
'template' => "n/a",
|
57 |
+
'html' => (strtolower($this->getType()) == 'html'),
|
58 |
+
'email_body' => $this->getBody()));
|
59 |
+
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/Model/Email/Log.php
RENAMED
@@ -9,6 +9,7 @@
|
|
9 |
|
10 |
class Aschroder_SMTPPro_Model_Email_Log extends Mage_Core_Model_Abstract
|
11 |
{
|
|
|
12 |
/**
|
13 |
* Model initialization
|
14 |
*
|
@@ -17,4 +18,15 @@ class Aschroder_SMTPPro_Model_Email_Log extends Mage_Core_Model_Abstract
|
|
17 |
{
|
18 |
$this->_init('smtppro/email_log');
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
9 |
|
10 |
class Aschroder_SMTPPro_Model_Email_Log extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
|
13 |
/**
|
14 |
* Model initialization
|
15 |
*
|
18 |
{
|
19 |
$this->_init('smtppro/email_log');
|
20 |
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* clean up log table
|
24 |
+
*
|
25 |
+
* @param int|null $lifetime Lifetime of entries in days
|
26 |
+
*/
|
27 |
+
public function clean($lifetime = null)
|
28 |
+
{
|
29 |
+
$this->getResource()->clean($lifetime);
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
}
|
app/code/local/Aschroder/SMTPPro/Model/Email/Template.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This class wraps the Template email sending functionality
|
5 |
+
* If SMTP Pro is enabled it will send emails using the given
|
6 |
+
* configuration.
|
7 |
+
*
|
8 |
+
* @author Ashley Schroder (aschroder.com)
|
9 |
+
* @copyright Copyright (c) 2014 ASchroder Consulting Ltd
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Aschroder_SMTPPro_Model_Email_Template extends Mage_Core_Model_Email_Template
|
13 |
+
{
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Send mail to recipient
|
18 |
+
*
|
19 |
+
* @param array|string $email E-mail(s)
|
20 |
+
* @param array|string|null $name receiver name(s)
|
21 |
+
* @param array $variables template variables
|
22 |
+
* @return boolean
|
23 |
+
**/
|
24 |
+
public function send($email, $name = null, array $variables = array())
|
25 |
+
{
|
26 |
+
|
27 |
+
$_helper = Mage::helper('smtppro');
|
28 |
+
// If it's not enabled, just return the parent result.
|
29 |
+
if (!$_helper->isEnabled()) {
|
30 |
+
$_helper->log('SMTP Pro is not enabled, fall back to parent class');
|
31 |
+
return parent::send($email, $name, $variables);
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
// As per parent class - except addition of before and after send events
|
36 |
+
|
37 |
+
if (!$this->isValidForSend()) {
|
38 |
+
$_helper->log('Email is not valid for sending, this is a core error that often means there\'s a problem with your email templates.');
|
39 |
+
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
$emails = array_values((array)$email);
|
44 |
+
$names = is_array($name) ? $name : (array)$name;
|
45 |
+
$names = array_values($names);
|
46 |
+
foreach ($emails as $key => $email) {
|
47 |
+
if (!isset($names[$key])) {
|
48 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
$variables['email'] = reset($emails);
|
53 |
+
$variables['name'] = reset($names);
|
54 |
+
|
55 |
+
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
|
56 |
+
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
|
57 |
+
|
58 |
+
$mail = $this->getMail();
|
59 |
+
|
60 |
+
$setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
|
61 |
+
switch ($setReturnPath) {
|
62 |
+
case 1:
|
63 |
+
$returnPathEmail = $this->getSenderEmail();
|
64 |
+
break;
|
65 |
+
case 2:
|
66 |
+
$returnPathEmail = Mage::getStoreConfig(self::XML_PATH_SENDING_RETURN_PATH_EMAIL);
|
67 |
+
break;
|
68 |
+
default:
|
69 |
+
$returnPathEmail = null;
|
70 |
+
break;
|
71 |
+
}
|
72 |
+
|
73 |
+
if ($returnPathEmail !== null) {
|
74 |
+
$mailTransport = new Zend_Mail_Transport_Sendmail("-f".$returnPathEmail);
|
75 |
+
Zend_Mail::setDefaultTransport($mailTransport);
|
76 |
+
}
|
77 |
+
|
78 |
+
foreach ($emails as $key => $email) {
|
79 |
+
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->setUseAbsoluteLinks(true);
|
83 |
+
$text = $this->getProcessedTemplate($variables, true);
|
84 |
+
|
85 |
+
if($this->isPlain()) {
|
86 |
+
$mail->setBodyText($text);
|
87 |
+
} else {
|
88 |
+
$mail->setBodyHTML($text);
|
89 |
+
}
|
90 |
+
|
91 |
+
$mail->setSubject('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?=');
|
92 |
+
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
93 |
+
|
94 |
+
try {
|
95 |
+
|
96 |
+
$transport = new Varien_Object();
|
97 |
+
Mage::dispatchEvent('aschroder_smtppro_template_before_send', array(
|
98 |
+
'mail' => $mail,
|
99 |
+
'template' => $this,
|
100 |
+
'variables' => $variables,
|
101 |
+
'transport' => $transport
|
102 |
+
));
|
103 |
+
|
104 |
+
if ($transport->getTransport()) { // if set by an observer, use it
|
105 |
+
$mail->send($transport->getTransport());
|
106 |
+
} else {
|
107 |
+
$mail->send();
|
108 |
+
}
|
109 |
+
|
110 |
+
foreach ($emails as $key => $email) {
|
111 |
+
Mage::dispatchEvent('aschroder_smtppro_after_send', array(
|
112 |
+
'to' => $email,
|
113 |
+
'template' => $this->getTemplateId(),
|
114 |
+
'subject' => $this->getProcessedTemplateSubject($variables),
|
115 |
+
'html' => !$this->isPlain(),
|
116 |
+
'email_body' => $text));
|
117 |
+
}
|
118 |
+
|
119 |
+
$this->_mail = null;
|
120 |
+
}
|
121 |
+
catch (Exception $e) {
|
122 |
+
$this->_mail = null;
|
123 |
+
Mage::logException($e);
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Aschroder_SMTPPro_Model_Mysql4_Email_Log extends Mage_Core_Model_Mysql4_Abstract {
|
11 |
+
/**
|
12 |
+
* Resource model initialization
|
13 |
+
*/
|
14 |
+
protected function _construct() {
|
15 |
+
$this->_init('smtppro/email_log', 'email_id');
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Clean up log table.
|
20 |
+
*
|
21 |
+
* @param int|null $lifetime Lifetime of entries in days
|
22 |
+
* @return Aschroder_SMTPPro_Model_Mysql4_Email_Log
|
23 |
+
*/
|
24 |
+
public function clean($lifetime = null) {
|
25 |
+
if (!Mage::helper('smtppro')->isLogCleaningEnabled()) {
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
if (is_null($lifetime)) {
|
29 |
+
$lifetime = Mage::helper('smtppro')->getLogLifetimeDays();
|
30 |
+
}
|
31 |
+
$cleanTime = $this->formatDate(time() - $lifetime * 3600 * 24, false);
|
32 |
+
|
33 |
+
$readAdapter = $this->_getReadAdapter();
|
34 |
+
$writeAdapter = $this->_getWriteAdapter();
|
35 |
+
|
36 |
+
while (true) {
|
37 |
+
$select = $readAdapter->select()
|
38 |
+
->from(
|
39 |
+
$this->getMainTable(),
|
40 |
+
$this->getIdFieldName()
|
41 |
+
)
|
42 |
+
->where('log_at < ?', $cleanTime)
|
43 |
+
->order('log_at ASC')
|
44 |
+
->limit(100);
|
45 |
+
|
46 |
+
$logIds = $readAdapter->fetchCol($select);
|
47 |
+
|
48 |
+
if (!$logIds) {
|
49 |
+
break;
|
50 |
+
}
|
51 |
+
|
52 |
+
$condition = array($this->getIdFieldName() . ' IN (?)' => $logIds);
|
53 |
+
|
54 |
+
// remove email log entries
|
55 |
+
$writeAdapter->delete($this->getMainTable(), $condition);
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Email/Log/Collection.php
RENAMED
File without changes
|
app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Setup.php
RENAMED
File without changes
|
app/code/local/Aschroder/SMTPPro/Model/Observer.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Observer that logs emails after they have been sent
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Aschroder_SMTPPro_Model_Observer extends Varien_Object {
|
11 |
+
|
12 |
+
public function cleanOldLogs(Varien_Event_Observer $observer)
|
13 |
+
{
|
14 |
+
$lifetime = Mage::helper('smtppro')->getLogLifetimeDays();
|
15 |
+
$log = Mage::getModel('smtppro/email_log')->clean($lifetime);
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Expects observer with data:
|
21 |
+
* 'to', 'subject', 'template',
|
22 |
+
* 'html', 'email_body'
|
23 |
+
*
|
24 |
+
* @param $observer
|
25 |
+
*/
|
26 |
+
public function log($observer) {
|
27 |
+
|
28 |
+
$event = $observer->getEvent();
|
29 |
+
Mage::helper('smtppro')->logEmailSent(
|
30 |
+
$event->getTo(),
|
31 |
+
$event->getTemplate(),
|
32 |
+
$event->getSubject(),
|
33 |
+
$event->getEmailBody(),
|
34 |
+
$event->getHtml());
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Expects observer with:
|
39 |
+
* 'mail', the mail about to be sent
|
40 |
+
* 'email', the email object initiating the send
|
41 |
+
* 'transport', an initially empty transport Object, will be used if set.
|
42 |
+
*
|
43 |
+
* @param $observer
|
44 |
+
*/
|
45 |
+
public function beforeSend($observer) {
|
46 |
+
Mage::helper('smtppro')->log($observer->getEvent()->getMail());
|
47 |
+
$observer->getEvent()->getTransport()->setTransport(Mage::helper('smtppro')->getTransport());
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Expects observer with:
|
52 |
+
* 'mail', the mail about to be sent
|
53 |
+
* 'template', the template being used
|
54 |
+
* 'variables', the variables used in the template
|
55 |
+
* 'transport', an initially empty transport Object, will be used if set.
|
56 |
+
*
|
57 |
+
* @param $observer
|
58 |
+
*/
|
59 |
+
public function beforeSendTemplate($observer) {
|
60 |
+
Mage::helper('smtppro')->log($observer->getEvent()->getMail());
|
61 |
+
$observer->getEvent()->getTransport()->setTransport(Mage::helper('smtppro')->getTransport());
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Authentication.php
RENAMED
@@ -13,7 +13,7 @@ class Aschroder_SMTPPro_Model_System_Config_Source_Smtp_Authentication
|
|
13 |
// There are 3 possibilities: PLAIN, LOGIN and CRAM-MD5, plus no authentication
|
14 |
// http://framework.zend.com/manual/en/zend.mail.smtp-authentication.html
|
15 |
return array(
|
16 |
-
"none" => Mage::helper('adminhtml')->__('None
|
17 |
"login" => Mage::helper('adminhtml')->__('Login'),
|
18 |
"plain" => Mage::helper('adminhtml')->__('Plain'),
|
19 |
"crammd5" => Mage::helper('adminhtml')->__('CRAM-MD5')
|
13 |
// There are 3 possibilities: PLAIN, LOGIN and CRAM-MD5, plus no authentication
|
14 |
// http://framework.zend.com/manual/en/zend.mail.smtp-authentication.html
|
15 |
return array(
|
16 |
+
"none" => Mage::helper('adminhtml')->__('None'),
|
17 |
"login" => Mage::helper('adminhtml')->__('Login'),
|
18 |
"plain" => Mage::helper('adminhtml')->__('Plain'),
|
19 |
"crammd5" => Mage::helper('adminhtml')->__('CRAM-MD5')
|
app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Development.php
RENAMED
File without changes
|
app/code/local/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @copyright Copyright (c) 2009 Ashley Schroder
|
4 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
5 |
+
* @author Ashley Schroder
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Aschroder_SMTPPro_Model_System_Config_Source_Smtp_Option extends Varien_Object
|
9 |
+
{
|
10 |
+
|
11 |
+
public function toOptionArray()
|
12 |
+
{
|
13 |
+
$options = array(
|
14 |
+
"disabled" => Mage::helper('smtppro')->__('Disabled'),
|
15 |
+
"google" => Mage::helper('smtppro')->__('Google Apps or Gmail'),
|
16 |
+
"smtp" => Mage::helper('smtppro')->__('Custom SMTP'),
|
17 |
+
"sendgrid" => Mage::helper('smtppro')->__('SendGrid'),
|
18 |
+
"ses" => Mage::helper('smtppro')->__('Amazon SES')
|
19 |
+
);
|
20 |
+
return $options;
|
21 |
+
}
|
22 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Ssl.php
RENAMED
File without changes
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Basesmtp.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Abstract base class for all SMTP-based transports
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Aschroder_SMTPPro_Model_Transports_Basesmtp {
|
12 |
+
|
13 |
+
|
14 |
+
public function getTransport($storeId) {
|
15 |
+
|
16 |
+
$_helper = Mage::helper('smtppro');
|
17 |
+
|
18 |
+
$name = $this->getName($storeId);
|
19 |
+
$email = $this->getEmail($storeId);
|
20 |
+
$password = $this->getPassword($storeId);
|
21 |
+
$host = $this->getHost($storeId);
|
22 |
+
$port = $this->getPort($storeId);
|
23 |
+
$auth = $this->getAuth($storeId);
|
24 |
+
$ssl = $this->getSsl($storeId);
|
25 |
+
|
26 |
+
$_helper->log("Using $name Transport.");
|
27 |
+
|
28 |
+
$config = array(
|
29 |
+
'ssl' => $ssl,
|
30 |
+
'port' => $port,
|
31 |
+
'auth' => $auth,
|
32 |
+
'username' => $email,
|
33 |
+
'password' => $password
|
34 |
+
);
|
35 |
+
|
36 |
+
$emailTransport = new Zend_Mail_Transport_Smtp($host, $config);
|
37 |
+
return $emailTransport;
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Disabled.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Not a real transport - placeholder for disabled option.
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Aschroder_SMTPPro_Model_Transports_Basesmtp {
|
12 |
+
|
13 |
+
|
14 |
+
public function getTransport($storeId) {
|
15 |
+
return null; // disabled transport = null
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Google.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Ashley Schroder (aschroder.com)
|
4 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
5 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Aschroder_SMTPPro_Model_Transports_Google extends Aschroder_SMTPPro_Model_Transports_Basesmtp {
|
9 |
+
|
10 |
+
public function getName($storeId) {
|
11 |
+
return "Google Apps/Gmail";
|
12 |
+
}
|
13 |
+
public function getEmail($storeId) {
|
14 |
+
return Mage::helper('smtppro')->getGoogleAppsEmail($storeId);
|
15 |
+
}
|
16 |
+
public function getPassword($storeId) {
|
17 |
+
return Mage::helper('smtppro')->getGoogleAppsPassword($storeId);
|
18 |
+
}
|
19 |
+
public function getHost($storeId) {
|
20 |
+
return "smtp.gmail.com";
|
21 |
+
}
|
22 |
+
public function getPort($storeId) {
|
23 |
+
return 587;
|
24 |
+
}
|
25 |
+
public function getAuth($storeId) {
|
26 |
+
return 'login';
|
27 |
+
}
|
28 |
+
public function getSsl($storeId) {
|
29 |
+
return 'tls';
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Sendgrid.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Ashley Schroder (aschroder.com)
|
4 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
5 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Aschroder_SMTPPro_Model_Transports_Sendgrid extends Aschroder_SMTPPro_Model_Transports_Basesmtp {
|
9 |
+
|
10 |
+
public function getName($storeId) {
|
11 |
+
return "Sendgrid";
|
12 |
+
}
|
13 |
+
public function getEmail($storeId) {
|
14 |
+
return Mage::helper('smtppro')->getSendGridEmail($storeId);
|
15 |
+
}
|
16 |
+
public function getPassword($storeId) {
|
17 |
+
return Mage::helper('smtppro')->getSendGridPassword($storeId);
|
18 |
+
}
|
19 |
+
public function getHost($storeId) {
|
20 |
+
return "smtp.sendgrid.net";
|
21 |
+
}
|
22 |
+
public function getPort($storeId) {
|
23 |
+
return 587;
|
24 |
+
}
|
25 |
+
public function getAuth($storeId) {
|
26 |
+
return 'login';
|
27 |
+
}
|
28 |
+
public function getSsl($storeId) {
|
29 |
+
return 'tls';
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Ses.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Amazon SES API Transport
|
5 |
+
*
|
6 |
+
* Big thanks to Christopher Valles
|
7 |
+
* https://github.com/christophervalles/Amazon-SES-Zend-Mail-Transport
|
8 |
+
*
|
9 |
+
* @author Ashley Schroder (aschroder.com)
|
10 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
11 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Aschroder_SMTPPro_Model_Transports_Ses {
|
15 |
+
|
16 |
+
|
17 |
+
public function getTransport($storeId) {
|
18 |
+
|
19 |
+
$_helper = Mage::helper('smtppro');
|
20 |
+
$_helper->log("Getting Amazon SES Transport");
|
21 |
+
|
22 |
+
$path = Mage::getModuleDir('', 'Aschroder_SMTPPro');
|
23 |
+
include_once $path . '/lib/AmazonSES.php';
|
24 |
+
|
25 |
+
$emailTransport = new App_Mail_Transport_AmazonSES(
|
26 |
+
array(
|
27 |
+
'accessKey' => $_helper->getAmazonSESAccessKey($storeId),
|
28 |
+
'privateKey' => $_helper->getAmazonSESPrivateKey($storeId)
|
29 |
+
)
|
30 |
+
);
|
31 |
+
|
32 |
+
$_helper->log("access is: " . print_r($_helper->getAmazonSESAccessKey($storeId), true));
|
33 |
+
$_helper->log("pk is: " . print_r($_helper->getAmazonSESPrivateKey($storeId), true));
|
34 |
+
$_helper->log("Transport is: " . print_r($emailTransport, true));
|
35 |
+
|
36 |
+
return $emailTransport;
|
37 |
+
}
|
38 |
+
}
|
app/code/local/Aschroder/SMTPPro/Model/Transports/Smtp.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Ashley Schroder (aschroder.com)
|
4 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
5 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Aschroder_SMTPPro_Model_Transports_Smtp extends Aschroder_SMTPPro_Model_Transports_Basesmtp {
|
9 |
+
|
10 |
+
public function getName($storeId) {
|
11 |
+
return "Custom SMTP";
|
12 |
+
}
|
13 |
+
public function getEmail($storeId) {
|
14 |
+
return Mage::helper('smtppro')->getSMTPSettingsUsername($storeId);
|
15 |
+
}
|
16 |
+
public function getPassword($storeId) {
|
17 |
+
return Mage::helper('smtppro')->getSMTPSettingsPassword($storeId);
|
18 |
+
}
|
19 |
+
public function getHost($storeId) {
|
20 |
+
return Mage::helper('smtppro')->getSMTPSettingsHost($storeId);
|
21 |
+
}
|
22 |
+
public function getPort($storeId) {
|
23 |
+
return Mage::helper('smtppro')->getSMTPSettingsPort($storeId);
|
24 |
+
}
|
25 |
+
public function getAuth($storeId) {
|
26 |
+
return Mage::helper('smtppro')->getSMTPSettingsAuthentication($storeId);
|
27 |
+
}
|
28 |
+
public function getSsl($storeId) {
|
29 |
+
return Mage::helper('smtppro')->getSMTPSettingsSSL($storeId);
|
30 |
+
}
|
31 |
+
}
|
app/code/{community → local}/Aschroder/SMTPPro/controllers/LogController.php
RENAMED
File without changes
|
app/code/local/Aschroder/SMTPPro/controllers/TestController.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Test the Email sending and configuration integrity
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2014 ASchroder Consulting Ltd
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class Aschroder_SMTPPro_TestController extends Mage_Adminhtml_Controller_Action
|
11 |
+
{
|
12 |
+
|
13 |
+
// We use the contacts form template as a test template
|
14 |
+
const XML_PATH_TEST_TEMPLATE = 'contacts/email/email_template';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @todo change this
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
protected $TEST_EMAIL = "test@example.com";
|
21 |
+
|
22 |
+
|
23 |
+
protected $EXPECTED_REWRITE_CLASSES = array(
|
24 |
+
"email_rewrite" => "Aschroder_SMTPPro_Model_Email",
|
25 |
+
"email_template_rewrite" => "Aschroder_SMTPPro_Model_Email_Template"
|
26 |
+
);
|
27 |
+
|
28 |
+
protected $KNOWN_ERRORS = array(
|
29 |
+
"/Email address is not verified/" => "Either your sending or receiving email address is not verified.<br/>Please check your Amazon SES console and confirm the email addresses are verified and the region matches.",
|
30 |
+
"/RequestExpired/" => "Check the date and time on your server is set correctly.<br/>Amazon's servers think your server time is more than 5 minutes different to their time and are rejecting the request."
|
31 |
+
);
|
32 |
+
|
33 |
+
public function indexAction()
|
34 |
+
{
|
35 |
+
$_helper = Mage::helper('smtppro');
|
36 |
+
|
37 |
+
$_helper->log("Running SMTPPro Self Test");
|
38 |
+
|
39 |
+
$success = true;
|
40 |
+
$websiteModel = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
|
41 |
+
$this->TEST_EMAIL = Mage::getStoreConfig('trans_email/ident_general/email', $websiteModel->getId());
|
42 |
+
|
43 |
+
$msg = "SMTPPro Self Test Results";
|
44 |
+
|
45 |
+
if (!$_helper->isEnabled()) {
|
46 |
+
$msg = $msg . "<br/> Extension disabled, cannot run test.";
|
47 |
+
$_helper->log("skipped, disabled.");
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError($msg);
|
49 |
+
$this->_redirectReferer();
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
// check the re-writes have not clashed
|
54 |
+
$_helper->log("Checking config re-writes have not clashed.");
|
55 |
+
|
56 |
+
$email_rewrite = "".Mage::getConfig()->getNode('global/models/core/rewrite/email');
|
57 |
+
$email_template_rewrite = "".Mage::getConfig()->getNode('global/models/core/rewrite/email_template');
|
58 |
+
|
59 |
+
if ($this->checkRewrite($this->EXPECTED_REWRITE_CLASSES["email_rewrite"], $email_rewrite)) {
|
60 |
+
$success = false;
|
61 |
+
$msg = $msg . "<br/> Detected overwrite conflict: $email_rewrite";
|
62 |
+
$_helper->log("Detected overwrite conflict: $email_rewrite");
|
63 |
+
}
|
64 |
+
if ($this->checkRewrite($this->EXPECTED_REWRITE_CLASSES["email_template_rewrite"], $email_template_rewrite)) {
|
65 |
+
$success = false;
|
66 |
+
$msg = $msg . "<br/> Detected overwrite conflict: $email_template_rewrite";
|
67 |
+
$_helper->log("Detected overwrite conflict: $email_template_rewrite");
|
68 |
+
}
|
69 |
+
|
70 |
+
// Hosts often block SMTP outbound connections, so we check for that here
|
71 |
+
|
72 |
+
$transport = $_helper->getTransport($websiteModel->getId());
|
73 |
+
|
74 |
+
if (is_subclass_of($transport, 'Aschroder_SMTPPro_Model_Transports_Basesmtp')) {
|
75 |
+
$_helper->log("Raw connection test for SMTP options.");
|
76 |
+
$fp = false;
|
77 |
+
|
78 |
+
try {
|
79 |
+
$fp = fsockopen($transport->getHost(), $transport->getPort(), $errno, $errstr, 15);
|
80 |
+
} catch ( Exception $e) {
|
81 |
+
// An error will be reported below.
|
82 |
+
}
|
83 |
+
|
84 |
+
Mage::helper('smtppro')->log("Complete");
|
85 |
+
|
86 |
+
if (!$fp) {
|
87 |
+
$success = false;
|
88 |
+
$_helper->log("Failed to connect to SMTP server. Reason: " . $errstr . "(" . $errno . ")");
|
89 |
+
$msg = $msg . "<br/>Failed to connect to SMTP server. Reason: " . $errstr . "(" . $errno . ")";
|
90 |
+
$msg = $msg . "<br/> This extension requires an outbound SMTP connection on port: " . $transport->getPort();
|
91 |
+
} else {
|
92 |
+
$_helper->log("Connection to Host SMTP server successful");
|
93 |
+
$msg = $msg . "<br/> Connection to Host SMTP server successful.";
|
94 |
+
fclose($fp);
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$_helper->log("Skipping raw connection test for non-SMTP options.");
|
98 |
+
}
|
99 |
+
|
100 |
+
$to = Mage::getStoreConfig('contacts/email/recipient_email', $websiteModel->getId());
|
101 |
+
|
102 |
+
$mail = new Zend_Mail();
|
103 |
+
$sub = "Test Email From SMTPPro Magento Extension";
|
104 |
+
$body =
|
105 |
+
"Hi,\n\n" .
|
106 |
+
"This is a Test Email from your Magento Store. If you are seeing this email then your " .
|
107 |
+
"SMTPPro settings are correct! \n\n" .
|
108 |
+
"For more information about this extension and " .
|
109 |
+
"tips for using it please visit magesmtppro.com or contact me, support@aschroder.com.\n\n" .
|
110 |
+
"Regards,\nAshley";
|
111 |
+
|
112 |
+
$mail->addTo($to)
|
113 |
+
->setFrom($this->TEST_EMAIL)
|
114 |
+
->setSubject($sub)
|
115 |
+
->setBodyText($body);
|
116 |
+
|
117 |
+
$_helper->log("Actual email sending test....");
|
118 |
+
$msg = $msg . "<br/> Sending test email to your contact form address: " . $to . " from: " . $this->TEST_EMAIL;
|
119 |
+
|
120 |
+
try {
|
121 |
+
|
122 |
+
$transport = new Varien_Object(); // for observers to set if required
|
123 |
+
Mage::dispatchEvent('aschroder_smtppro_before_send', array(
|
124 |
+
'mail' => $mail,
|
125 |
+
'email' => $this,
|
126 |
+
'transport' => $transport
|
127 |
+
));
|
128 |
+
|
129 |
+
$emailTransport = $transport->getTransport();
|
130 |
+
|
131 |
+
if (!empty($emailTransport)) {
|
132 |
+
|
133 |
+
$mail->send($emailTransport);
|
134 |
+
|
135 |
+
Mage::dispatchEvent('aschroder_smtppro_after_send', array('to' => $to,
|
136 |
+
'template' => "Email Self Test",
|
137 |
+
'subject' => $sub,
|
138 |
+
'html' => false,
|
139 |
+
'email_body' => $body));
|
140 |
+
|
141 |
+
$msg = $msg . "<br/> Test email was sent successfully.";
|
142 |
+
$_helper->log("Test email was sent successfully");
|
143 |
+
|
144 |
+
} else {
|
145 |
+
$success = false;
|
146 |
+
$_helper->log("Failed to find transport for test....");
|
147 |
+
$msg = $msg . "<br/> Failed to find transport for test. ";
|
148 |
+
}
|
149 |
+
|
150 |
+
} catch (Exception $e) {
|
151 |
+
$success = false;
|
152 |
+
$msg = $msg . "<br/> Unable to send test email.";
|
153 |
+
if ($help = $this->knowError($e->getMessage())) {
|
154 |
+
$msg = $msg . "<br/> " . $help;
|
155 |
+
} else {
|
156 |
+
$msg = $msg . "<br/> Exception message was: " . $e->getMessage() . "...";
|
157 |
+
$msg = $msg . "<br/> Please check the user guide for frequent error messages and their solutions.";
|
158 |
+
}
|
159 |
+
$_helper->log("Test email was not sent successfully: " . $e->getMessage() . "\n See exception log for more details.");
|
160 |
+
Mage::logException($e);
|
161 |
+
}
|
162 |
+
|
163 |
+
$_helper->log("Checking that a template exists for the default locale and that email communications are enabled....");
|
164 |
+
|
165 |
+
try {
|
166 |
+
|
167 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
168 |
+
$testTemplateId = Mage::getStoreConfig(self::XML_PATH_TEST_TEMPLATE);
|
169 |
+
|
170 |
+
if (is_numeric($testTemplateId)) {
|
171 |
+
$mailTemplate->load($testTemplateId);
|
172 |
+
} else {
|
173 |
+
$localeCode = Mage::getStoreConfig('general/locale/code');
|
174 |
+
$mailTemplate->loadDefault($testTemplateId, $localeCode);
|
175 |
+
}
|
176 |
+
|
177 |
+
$mailTemplate->setSenderName("Test Name");
|
178 |
+
$mailTemplate->setSenderEmail("test@email.com");
|
179 |
+
|
180 |
+
if ($mailTemplate->isValidForSend()) {
|
181 |
+
$msg = $msg . "<br/> Default templates exist.";
|
182 |
+
$msg = $msg . "<br/> Email communications are enabled.";
|
183 |
+
$_helper->log("Default templates exist and email communications are enabled.");
|
184 |
+
} else {
|
185 |
+
$success = false;
|
186 |
+
$msg = $msg . "<br/> Could not find default template, or template not valid, or email communications disabled in Advanced > System settings.";
|
187 |
+
$msg = $msg . "<br/> Please check that you have templates in place for your emails. These are in app/locale, or custom defined in System > Transaction Emails. Also check Advanced > System settings to ensure email communications are enabled.";
|
188 |
+
$_helper->log("Could not find default template, or template not valid, or email communications disabled in Advanced > System settings");
|
189 |
+
}
|
190 |
+
|
191 |
+
} catch (Exception $e) {
|
192 |
+
|
193 |
+
$success = false;
|
194 |
+
$msg = $msg . "<br/> Could not test default template validity.";
|
195 |
+
$msg = $msg . "<br/> Exception message was: " . $e->getMessage() . "...";
|
196 |
+
$msg = $msg . "<br/> Please check that you have templates in place for your emails. These are in app/locale, or custom defined in System > Transaction Emails.";
|
197 |
+
$_helper->log("Could not test default template validity: " . $e->getMessage());
|
198 |
+
}
|
199 |
+
|
200 |
+
$_helper->log("Checking that tables are created....");
|
201 |
+
|
202 |
+
try {
|
203 |
+
|
204 |
+
$logName = Mage::getSingleton('core/resource')->getTableName("smtppro_email_log");
|
205 |
+
$logExists = Mage::getSingleton('core/resource')->getConnection('core_read')->isTableExists($logName);
|
206 |
+
|
207 |
+
if (!$logExists) {
|
208 |
+
$success = false;
|
209 |
+
$msg = $msg . "<br/> Could not find required database tables.";
|
210 |
+
$msg = $msg . "<br/> Please try to manually re-run the table creation script. For assistance please contact us.";
|
211 |
+
$_helper->log("Could not find required tables.");
|
212 |
+
} else {
|
213 |
+
$msg = $msg . "<br/> Required database tables exist.";
|
214 |
+
$_helper->log("Required database tables exist.");
|
215 |
+
}
|
216 |
+
|
217 |
+
} catch (Exception $e) {
|
218 |
+
|
219 |
+
$success = false;
|
220 |
+
$msg = $msg . "<br/> Could not find required database tables.";
|
221 |
+
$msg = $msg . "<br/> Exception message was: " . $e->getMessage() . "...";
|
222 |
+
$msg = $msg . "<br/> Please try to manually re-run the table creation script. For assistance please contact us.";
|
223 |
+
$_helper->log("Could not find required tables: " . $e->getMessage());
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
$_helper->log("Complete");
|
228 |
+
|
229 |
+
if ($success) {
|
230 |
+
$msg = $msg . "<br/> Testing complete, if you are still experiencing difficulties please visit <a target='_blank' href='http://magesmtppro.com'>the support page</a> or contact me via <a target='_blank' href='mailto:support@aschroder.com'>support@aschroder.com</a> for support.";
|
231 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($msg);
|
232 |
+
} else {
|
233 |
+
$msg = $msg . "<br/> Testing failed, please review the reported problems and if you need further help visit <a target='_blank' href='http://magesmtppro.com'>the support page</a> or contact me via <a target='_blank' href='mailto:support@aschroder.com'>support@aschroder.com</a> for support.";
|
234 |
+
Mage::getSingleton('adminhtml/session')->addError($msg);
|
235 |
+
}
|
236 |
+
|
237 |
+
$this->_redirectReferer();
|
238 |
+
}
|
239 |
+
|
240 |
+
private function knowError($message) {
|
241 |
+
|
242 |
+
foreach($this->KNOWN_ERRORS as $known => $help) {
|
243 |
+
if (preg_match($known, $message)) {
|
244 |
+
return $help;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
return false;
|
248 |
+
}
|
249 |
+
|
250 |
+
private function checkRewrite($expected, $actual) {
|
251 |
+
|
252 |
+
return $expected != $actual &&
|
253 |
+
!is_subclass_of($actual, $expected);
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
app/code/local/Aschroder/SMTPPro/etc/config.xml
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* SMTP Pro integration.
|
5 |
+
*
|
6 |
+
* @package Aschroder_SMTPPro
|
7 |
+
* @author Ashley Schroder (aschroder.com)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Aschroder_SMTPPro>
|
13 |
+
<version>2.0.0</version>
|
14 |
+
</Aschroder_SMTPPro>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<smtppro>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Aschroder_SMTPPro</module>
|
22 |
+
<frontName>smtppro</frontName>
|
23 |
+
</args>
|
24 |
+
</smtppro>
|
25 |
+
</routers>
|
26 |
+
</frontend>
|
27 |
+
<global>
|
28 |
+
<helpers>
|
29 |
+
<smtppro><class>Aschroder_SMTPPro_Helper</class></smtppro>
|
30 |
+
</helpers>
|
31 |
+
<blocks>
|
32 |
+
<smtppro>
|
33 |
+
<class>Aschroder_SMTPPro_Block</class>
|
34 |
+
</smtppro>
|
35 |
+
</blocks>
|
36 |
+
<models>
|
37 |
+
<smtppro>
|
38 |
+
<class>Aschroder_SMTPPro_Model</class>
|
39 |
+
<resourceModel>smtppro_mysql4</resourceModel>
|
40 |
+
</smtppro>
|
41 |
+
<smtppro_mysql4>
|
42 |
+
<class>Aschroder_SMTPPro_Model_Mysql4</class>
|
43 |
+
<entities>
|
44 |
+
<email_log><table>smtppro_email_log</table></email_log>
|
45 |
+
</entities>
|
46 |
+
</smtppro_mysql4>
|
47 |
+
<core>
|
48 |
+
<rewrite>
|
49 |
+
<email>Aschroder_SMTPPro_Model_Email</email>
|
50 |
+
<email_template>Aschroder_SMTPPro_Model_Email_Template</email_template>
|
51 |
+
</rewrite>
|
52 |
+
</core>
|
53 |
+
</models>
|
54 |
+
<resources>
|
55 |
+
<smtppro_setup>
|
56 |
+
<setup>
|
57 |
+
<module>Aschroder_SMTPPro</module>
|
58 |
+
<class>Aschroder_SMTPPro_Model_Mysql4_Setup</class>
|
59 |
+
</setup>
|
60 |
+
<connection>
|
61 |
+
<use>core_setup</use>
|
62 |
+
</connection>
|
63 |
+
</smtppro_setup>
|
64 |
+
<smtppro_write>
|
65 |
+
<connection>
|
66 |
+
<use>core_write</use>
|
67 |
+
</connection>
|
68 |
+
</smtppro_write>
|
69 |
+
<smtppro_read>
|
70 |
+
<connection>
|
71 |
+
<use>core_read</use>
|
72 |
+
</connection>
|
73 |
+
</smtppro_read>
|
74 |
+
</resources>
|
75 |
+
<events>
|
76 |
+
<log_log_clean_after>
|
77 |
+
<observers>
|
78 |
+
<smtppro_email_log_clean>
|
79 |
+
<type>singleton</type>
|
80 |
+
<class>smtppro/observer</class>
|
81 |
+
<method>cleanOldLogs</method>
|
82 |
+
</smtppro_email_log_clean>
|
83 |
+
</observers>
|
84 |
+
</log_log_clean_after>
|
85 |
+
|
86 |
+
<aschroder_smtppro_after_send>
|
87 |
+
<observers>
|
88 |
+
<smtppro_email_after_send_observer>
|
89 |
+
<type>singleton</type>
|
90 |
+
<class>smtppro/observer</class>
|
91 |
+
<method>log</method>
|
92 |
+
</smtppro_email_after_send_observer>
|
93 |
+
</observers>
|
94 |
+
</aschroder_smtppro_after_send>
|
95 |
+
|
96 |
+
<aschroder_smtppro_before_send>
|
97 |
+
<observers>
|
98 |
+
<aschroder_smtppro_before_send_observer>
|
99 |
+
<type>singleton</type>
|
100 |
+
<class>smtppro/observer</class>
|
101 |
+
<method>beforeSend</method>
|
102 |
+
</aschroder_smtppro_before_send_observer>
|
103 |
+
</observers>
|
104 |
+
</aschroder_smtppro_before_send>
|
105 |
+
<aschroder_smtppro_template_before_send>
|
106 |
+
<observers>
|
107 |
+
<aschroder_smtppro_template_before_send_observer>
|
108 |
+
<type>singleton</type>
|
109 |
+
<class>smtppro/observer</class>
|
110 |
+
<method>beforeSendTemplate</method>
|
111 |
+
</aschroder_smtppro_template_before_send_observer>
|
112 |
+
</observers>
|
113 |
+
</aschroder_smtppro_template_before_send>
|
114 |
+
</events>
|
115 |
+
</global>
|
116 |
+
<adminhtml>
|
117 |
+
<menu>
|
118 |
+
<system>
|
119 |
+
<children>
|
120 |
+
<tools>
|
121 |
+
<children>
|
122 |
+
<smtppro translate="title" module="smtppro">
|
123 |
+
<title>SMTPPro - Email Log</title>
|
124 |
+
<action>smtppro/log</action>
|
125 |
+
</smtppro>
|
126 |
+
</children>
|
127 |
+
</tools>
|
128 |
+
</children>
|
129 |
+
</system>
|
130 |
+
</menu>
|
131 |
+
<acl>
|
132 |
+
<resources>
|
133 |
+
<admin>
|
134 |
+
<children>
|
135 |
+
<system>
|
136 |
+
<children>
|
137 |
+
<config>
|
138 |
+
<children>
|
139 |
+
<smtppro translate="title" module="smtppro">
|
140 |
+
<title>SMTP Pro Email Settings</title>
|
141 |
+
</smtppro>
|
142 |
+
</children>
|
143 |
+
</config>
|
144 |
+
<tools>
|
145 |
+
<children>
|
146 |
+
<smtppro translate="title" module="smtppro">
|
147 |
+
<title>Email Log</title>
|
148 |
+
</smtppro>
|
149 |
+
</children>
|
150 |
+
</tools>
|
151 |
+
</children>
|
152 |
+
</system>
|
153 |
+
</children>
|
154 |
+
</admin>
|
155 |
+
</resources>
|
156 |
+
</acl>
|
157 |
+
<translate>
|
158 |
+
<modules>
|
159 |
+
<Aschroder_SMTPPro>
|
160 |
+
<files>
|
161 |
+
<default>Aschroder_SMTPPro.csv</default>
|
162 |
+
</files>
|
163 |
+
</Aschroder_SMTPPro>
|
164 |
+
</modules>
|
165 |
+
</translate>
|
166 |
+
</adminhtml>
|
167 |
+
<default>
|
168 |
+
<smtppro>
|
169 |
+
<general>
|
170 |
+
<option>0</option>
|
171 |
+
<googleapps_email></googleapps_email>
|
172 |
+
<googleapps_gpassword backend_model="adminhtml/system_config_backend_encrypted" />
|
173 |
+
<sendgrid_email></sendgrid_email>
|
174 |
+
<sendgrid_password backend_model="adminhtml/system_config_backend_encrypted" />
|
175 |
+
<ses_access_key></ses_access_key>
|
176 |
+
<ses_private_key backend_model="adminhtml/system_config_backend_encrypted" />
|
177 |
+
<smtp_authentication></smtp_authentication>
|
178 |
+
<smtp_username></smtp_username>
|
179 |
+
<smtp_password backend_model="adminhtml/system_config_backend_encrypted" />
|
180 |
+
<smtp_host></smtp_host>
|
181 |
+
<smtp_port>25</smtp_port>
|
182 |
+
<smtp_ssl></smtp_ssl>
|
183 |
+
</general>
|
184 |
+
<debug>
|
185 |
+
<logenabled>0</logenabled>
|
186 |
+
<cleanlog>1</cleanlog>
|
187 |
+
<cleanlog_after_days>90</cleanlog_after_days>
|
188 |
+
<log_debug>0</log_debug>
|
189 |
+
</debug>
|
190 |
+
</smtppro>
|
191 |
+
</default>
|
192 |
+
</config>
|
app/code/local/Aschroder/SMTPPro/etc/system.xml
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<aschroder module="smtppro" translate="label">
|
5 |
+
<label>Aschroder Extensions</label>
|
6 |
+
<sort_order>600</sort_order>
|
7 |
+
<show_in_default>1</show_in_default>
|
8 |
+
<show_in_website>0</show_in_website>
|
9 |
+
<show_in_store>0</show_in_store>
|
10 |
+
</aschroder>
|
11 |
+
</tabs>
|
12 |
+
<sections>
|
13 |
+
<smtppro module="smtppro" translate="label">
|
14 |
+
<class>separator-top</class>
|
15 |
+
<label>SMTP Pro</label>
|
16 |
+
<tab>aschroder</tab>
|
17 |
+
<frontend_type>text</frontend_type>
|
18 |
+
<sort_order>110</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>0</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
<groups>
|
23 |
+
<general module="smtppro" translate="label comment">
|
24 |
+
<label>General Settings</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>0</show_in_store>
|
30 |
+
<comment><div style='background-color: #efefef;margin-bottom: 10px;height: 40px;'> <img style='float:left;width: 150px;' src='http://www.aschroder.com/smtppro-logo.png' /> <span style='float:left;font-size: 20px; margin:10px;'>SMTP Pro Email Extension</span> </div> Configure your SMTP connection below. If you have any questions or would like any help please visit <a href='http://magesmtppro.com' target='_blank'>magesmtppro.com</a>.</comment>
|
31 |
+
<fields>
|
32 |
+
<option translate="label comment">
|
33 |
+
<label>Email Connection</label>
|
34 |
+
<frontend_type>select</frontend_type>
|
35 |
+
<source_model>smtppro/system_config_source_smtp_option</source_model>
|
36 |
+
<sort_order>10</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>0</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
</option>
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
<googleapps_email translate="label">
|
45 |
+
<label>Google Apps Email Address</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>20</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>0</show_in_store>
|
51 |
+
<depends><option>google</option></depends>
|
52 |
+
</googleapps_email>
|
53 |
+
<googleapps_gpassword translate="label">
|
54 |
+
<label>Google Apps Password</label>
|
55 |
+
<comment>Input your Google Apps or Gmail username and password here. For configuration recommendations please see the guide at <a href='http://magesmtppro.com' target='_blank'>magesmtppro.com</a></comment>
|
56 |
+
<frontend_type>password</frontend_type>
|
57 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
58 |
+
<sort_order>23</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
<depends><option>google</option></depends>
|
63 |
+
</googleapps_gpassword>
|
64 |
+
|
65 |
+
<sendgrid_email translate="label">
|
66 |
+
<label>SendGrid Username</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<sort_order>20</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>0</show_in_store>
|
72 |
+
<depends><option>sendgrid</option></depends>
|
73 |
+
</sendgrid_email>
|
74 |
+
<sendgrid_password translate="label">
|
75 |
+
<label>SendGrid Password</label>
|
76 |
+
<comment>Input your SendGrid username and password here. For more information visit <a href='http://sendgrid.com' target='_blank'>SendGrid</a></comment>
|
77 |
+
<frontend_type>password</frontend_type>
|
78 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
79 |
+
<sort_order>23</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
<depends><option>sendgrid</option></depends>
|
84 |
+
</sendgrid_password>
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
<ses_access_key translate="label">
|
89 |
+
<label>Amazon SES Access Key</label>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<sort_order>20</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>0</show_in_store>
|
95 |
+
<depends><option>ses</option></depends>
|
96 |
+
</ses_access_key>
|
97 |
+
<ses_private_key translate="label">
|
98 |
+
<label>Amazon SES Secret Key</label>
|
99 |
+
<comment>Amazon SES support in SMTP Pro is limited and best suited to development and testing purposes. For a full integration with region selection, error/bounce logging and send statistics please see the premium extension: <a href='http://magesend.com' target='_blank'>MageSend</a></comment>
|
100 |
+
<frontend_type>password</frontend_type>
|
101 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
102 |
+
<sort_order>23</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>0</show_in_store>
|
106 |
+
<depends><option>ses</option></depends>
|
107 |
+
</ses_private_key>
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
<smtp_authentication translate="label comment">
|
112 |
+
<label>Authentication</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<source_model>smtppro/system_config_source_smtp_authentication</source_model>
|
115 |
+
<sort_order>20</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
<depends><option>smtp</option></depends>
|
120 |
+
</smtp_authentication>
|
121 |
+
<smtp_username translate="label comment">
|
122 |
+
<label>Username</label>
|
123 |
+
<frontend_type>text</frontend_type>
|
124 |
+
<sort_order>23</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>0</show_in_store>
|
128 |
+
<depends><option>smtp</option><smtp_authentication separator=",">login,plain,crammd5</smtp_authentication></depends>
|
129 |
+
</smtp_username>
|
130 |
+
<smtp_password translate="label comment">
|
131 |
+
<label>Password</label>
|
132 |
+
<frontend_type>password</frontend_type>
|
133 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
134 |
+
<sort_order>26</sort_order>
|
135 |
+
<show_in_default>1</show_in_default>
|
136 |
+
<show_in_website>1</show_in_website>
|
137 |
+
<show_in_store>0</show_in_store>
|
138 |
+
<depends><option>smtp</option><smtp_authentication separator=",">login,plain,crammd5</smtp_authentication></depends>
|
139 |
+
</smtp_password>
|
140 |
+
<smtp_host translate="label comment">
|
141 |
+
<label>Host</label>
|
142 |
+
<frontend_type>text</frontend_type>
|
143 |
+
<sort_order>29</sort_order>
|
144 |
+
<show_in_default>1</show_in_default>
|
145 |
+
<show_in_website>1</show_in_website>
|
146 |
+
<show_in_store>0</show_in_store>
|
147 |
+
<depends><option>smtp</option></depends>
|
148 |
+
</smtp_host>
|
149 |
+
<smtp_port translate="label comment">
|
150 |
+
<label>Port</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<sort_order>32</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>0</show_in_store>
|
156 |
+
<depends><option>smtp</option></depends>
|
157 |
+
</smtp_port>
|
158 |
+
<smtp_ssl translate="label comment">
|
159 |
+
<label>SSL Security</label>
|
160 |
+
<comment>Custom SMTP servers can be configured in this section. For more information about these configuration options and troubleshooting advice please see <a href='http://magesmtppro.com' target='_blank'>magesmtppro.com</a></comment>
|
161 |
+
<frontend_type>select</frontend_type>
|
162 |
+
<source_model>smtppro/system_config_source_smtp_ssl</source_model>
|
163 |
+
<sort_order>35</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>0</show_in_store>
|
167 |
+
<depends><option>smtp</option></depends>
|
168 |
+
</smtp_ssl>
|
169 |
+
|
170 |
+
</fields>
|
171 |
+
</general>
|
172 |
+
|
173 |
+
<debug module="smtppro" translate="label">
|
174 |
+
<label>Logging and Debugging</label>
|
175 |
+
<frontend_type>text</frontend_type>
|
176 |
+
<sort_order>50</sort_order>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>1</show_in_website>
|
179 |
+
<show_in_store>0</show_in_store>
|
180 |
+
<comment>Please only use these settings if you are a software developer or server admin.</comment>
|
181 |
+
<fields>
|
182 |
+
<logenabled translate="label comment">
|
183 |
+
<label>Log Emails</label>
|
184 |
+
<comment>This will log all outbound emails. View from System->Tools->SMTPPro - Email Log.</comment>
|
185 |
+
<frontend_type>select</frontend_type>
|
186 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
187 |
+
<sort_order>40</sort_order>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>0</show_in_website>
|
190 |
+
<show_in_store>0</show_in_store>
|
191 |
+
</logenabled>
|
192 |
+
<cleanlog translate="label comment">
|
193 |
+
<label>Clean Email Logs</label>
|
194 |
+
<comment><![CDATA[If this is set to yes, old entries will be deleted from email log. Cron is required and log cleaning must be enabled in system/log/enabled for this to work.]]></comment>
|
195 |
+
<frontend_type>select</frontend_type>
|
196 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
197 |
+
<sort_order>50</sort_order>
|
198 |
+
<show_in_default>1</show_in_default>
|
199 |
+
<show_in_website>0</show_in_website>
|
200 |
+
<show_in_store>0</show_in_store>
|
201 |
+
<depends><logenabled>1</logenabled></depends>
|
202 |
+
</cleanlog>
|
203 |
+
<cleanlog_after_days translate="label comment">
|
204 |
+
<label>Email Log Days Kept</label>
|
205 |
+
<frontend_type>text</frontend_type>
|
206 |
+
<sort_order>60</sort_order>
|
207 |
+
<show_in_default>1</show_in_default>
|
208 |
+
<show_in_website>0</show_in_website>
|
209 |
+
<show_in_store>0</show_in_store>
|
210 |
+
<depends><cleanlog>1</cleanlog><logenabled>1</logenabled></depends>
|
211 |
+
</cleanlog_after_days>
|
212 |
+
<log_debug translate="label comment">
|
213 |
+
<label>Enable Debug Logging</label>
|
214 |
+
<comment><![CDATA[If yes, a log file will be written with debug information.]]></comment>
|
215 |
+
<frontend_type>select</frontend_type>
|
216 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
217 |
+
<sort_order>70</sort_order>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>0</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
</log_debug>
|
222 |
+
<test translate="label comment">
|
223 |
+
<comment>Save settings before running this test.</comment>
|
224 |
+
<frontend_type>select</frontend_type>
|
225 |
+
<frontend_model>Aschroder_SMTPPro_Block_Adminhtml_Test</frontend_model>
|
226 |
+
<sort_order>80</sort_order>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>0</show_in_website>
|
229 |
+
<show_in_store>0</show_in_store>
|
230 |
+
</test>
|
231 |
+
</fields>
|
232 |
+
</debug>
|
233 |
+
<esp module="smtppro" translate="label">
|
234 |
+
<label>Compatible Email Services</label>
|
235 |
+
<frontend_type>text</frontend_type>
|
236 |
+
<sort_order>70</sort_order>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
<fields>
|
241 |
+
<logenabled translate="label comment">
|
242 |
+
<frontend_type>select</frontend_type>
|
243 |
+
<frontend_model>Aschroder_SMTPPro_Block_Adminhtml_Table</frontend_model>
|
244 |
+
<sort_order>40</sort_order>
|
245 |
+
<show_in_default>1</show_in_default>
|
246 |
+
<show_in_website>1</show_in_website>
|
247 |
+
<show_in_store>1</show_in_store>
|
248 |
+
</logenabled>
|
249 |
+
</fields>
|
250 |
+
</esp>
|
251 |
+
</groups>
|
252 |
+
</smtppro>
|
253 |
+
</sections>
|
254 |
+
</config>
|
app/code/{community → local}/Aschroder/SMTPPro/lib/AmazonSES.php
RENAMED
@@ -86,7 +86,6 @@ class App_Mail_Transport_AmazonSES extends Zend_Mail_Transport_Abstract
|
|
86 |
'Date' => $date,
|
87 |
'X-Amzn-Authorization' => $this->_buildAuthKey($date)
|
88 |
));
|
89 |
-
$client->setEncType('application/x-www-form-urlencoded');
|
90 |
|
91 |
//Build the parameters
|
92 |
$params = array(
|
@@ -97,10 +96,11 @@ class App_Mail_Transport_AmazonSES extends Zend_Mail_Transport_Abstract
|
|
97 |
|
98 |
$recipients = explode(',', $this->recipients);
|
99 |
while(list($index, $recipient) = each($recipients)){
|
100 |
-
$params[sprintf('
|
101 |
}
|
102 |
|
103 |
$client->resetParameters();
|
|
|
104 |
$client->setParameterPost($params);
|
105 |
$response = $client->request(Zend_Http_Client::POST);
|
106 |
|
86 |
'Date' => $date,
|
87 |
'X-Amzn-Authorization' => $this->_buildAuthKey($date)
|
88 |
));
|
|
|
89 |
|
90 |
//Build the parameters
|
91 |
$params = array(
|
96 |
|
97 |
$recipients = explode(',', $this->recipients);
|
98 |
while(list($index, $recipient) = each($recipients)){
|
99 |
+
$params[sprintf('Destinations.member.%d', $index + 1)] = $recipient;
|
100 |
}
|
101 |
|
102 |
$client->resetParameters();
|
103 |
+
$client->setEncType(Zend_Http_Client::ENC_URLENCODED);
|
104 |
$client->setParameterPost($params);
|
105 |
$response = $client->request(Zend_Http_Client::POST);
|
106 |
|
app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
Mage::helper('smtppro/mysql4_install')->prepareForDb();
|
16 |
+
|
17 |
+
Mage::helper('smtppro/mysql4_install')->attemptQuery($installer, "
|
18 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('smtppro_email_log')}` (
|
19 |
+
`email_id` int(10) unsigned NOT NULL auto_increment,
|
20 |
+
`log_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
21 |
+
`to` varchar(255) NOT NULL default '',
|
22 |
+
`template` varchar(255) NULL,
|
23 |
+
`subject` varchar(255) NULL,
|
24 |
+
`email_body` text,
|
25 |
+
PRIMARY KEY (`email_id`),
|
26 |
+
KEY `log_at` (`log_at`)
|
27 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
+
");
|
29 |
+
|
30 |
+
Mage::helper('smtppro/mysql4_install')->createInstallNotice("SMTP Pro was installed successfully.", "SMTP Pro has been installed successfully. Go to the system configuration section of your Magento admin to configure SMTP Pro and get it up and running.");
|
31 |
+
|
32 |
+
$installer->endSetup();
|
app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-upgrade-1.4.3-1.4.4.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @author Paul Hachmang (@paales)
|
7 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
$installer = $this;
|
13 |
+
|
14 |
+
$installer->startSetup();
|
15 |
+
|
16 |
+
Mage::helper('smtppro/mysql4_install')->attemptQuery($installer, "
|
17 |
+
ALTER TABLE `{$this->getTable('smtppro_email_log')}`
|
18 |
+
CHANGE `to` `email_to` VARCHAR(255) NOT NULL DEFAULT '';
|
19 |
+
");
|
20 |
+
|
21 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/smtppro/view.phtml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<h3><?php echo $this->__('Email Details') ?></h3>
|
13 |
</div>
|
14 |
<div class="email-detail">
|
15 |
-
<p><strong><?php echo $this->__('To:') ?></strong> <?php echo $email->
|
16 |
<p><strong><?php echo $this->__('Subject:') ?></strong> <?php echo $email->getSubject(); ?></p>
|
17 |
<p><strong><?php echo $this->__('Template:') ?></strong> <?php echo $email->getTemplate(); ?></p>
|
18 |
<p><strong><?php echo $this->__('Sent:') ?></strong> <?php echo $email->getLogAt(); ?></p>
|
12 |
<h3><?php echo $this->__('Email Details') ?></h3>
|
13 |
</div>
|
14 |
<div class="email-detail">
|
15 |
+
<p><strong><?php echo $this->__('To:') ?></strong> <?php echo $email->getEmailTo(); ?></p>
|
16 |
<p><strong><?php echo $this->__('Subject:') ?></strong> <?php echo $email->getSubject(); ?></p>
|
17 |
<p><strong><?php echo $this->__('Template:') ?></strong> <?php echo $email->getTemplate(); ?></p>
|
18 |
<p><strong><?php echo $this->__('Sent:') ?></strong> <?php echo $email->getLogAt(); ?></p>
|
app/etc/modules/Aschroder_SMTPPro.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<Aschroder_SMTPPro>
|
5 |
<active>true</active>
|
6 |
-
<codePool>
|
7 |
</Aschroder_SMTPPro>
|
8 |
</modules>
|
9 |
</config>
|
3 |
<modules>
|
4 |
<Aschroder_SMTPPro>
|
5 |
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
</Aschroder_SMTPPro>
|
8 |
</modules>
|
9 |
</config>
|
app/locale/de_DE/Aschroder_SMTPPro.csv
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
"SMTP Pro Email General Settings","SMTP Pro Email - Grundlegende Einstellungen"
|
2 |
-
"If you are experiencing problems with this extension please run the self diagnosing test by clicking the button below. The module will log what it is doing if you enable logging, this can be useful to determine problems aswell. If you have any questions or would like any help please visit <a href='http://aschroder.com' target='_blank'>ASchroder.com</a>.","Wenn Probleme mit dieser Erweiterung auftreten, starten Sie den Selbsttest durch Klick auf den Knopf unten. Das Modul wird alle Vorgänge protokollieren, wenn das Logging aktiviert ist, dies kann ebenfalls zum Aufdecken von Problemen genutzt werden. Sollten Sie Fragen haben oder wünschen sich Hilfe, so besuchen Sie bitte <a href='http://aschroder.com' target='_blank'>ASchroder.com</a>. "
|
3 |
-
"Choose extension option","Wählen Sie eine Versandoption"
|
4 |
-
"This will determine if the extension uses the simple Google Apps/Gmail configuration, The advanced SMTP configuration or disables the extension completely.","Dies entscheidet, ob die Google-Apps/Gmail-Konfiguration oder die erweiterte Konfiguration verwendet oder die Erweiterung komplett deaktiviert werden soll."
|
5 |
-
"Use Store Email Addresses for Reply-to","Store-E-Mail-Adressen für Antwort-an-Header verwenden"
|
6 |
-
"Development Mode options","Entwicklermodus"
|
7 |
-
"Development Mode disabled","Entwicklermodus deaktiviert"
|
8 |
-
"Redirect to contact form email","Auf Kontaktformular-Adresse weiterleiten"
|
9 |
-
"Supress all emails","Alle E-Mails unterdrücken"
|
10 |
-
"These options can be used during development and testing to control the destination of all emails, or to stop Magento emails sending. (Note: if extensions do not send emails 'the magento way' then they will not be supressed)","Diese Optionen können während Entwicklung und Testphase genutzt werden, um das Mail-Ziel zu steuern oder alle Magento-E-Mails abzufangen. (Hinweis: Wenn eine Erweiterung Mails am Magento-Standard vorbei sendet, können sie nicht beeinflusst werden)"
|
11 |
-
"Log all messages","Alle Nachrichten protokollieren"
|
12 |
-
"Email Log","E-Mail-Protokoll"
|
13 |
-
"This will log all outbound emails to the table smtppro_email_log and allow viewing within the admin interface from System->Tools->Email Log.","Dies wird alle ausgehenden E-Mails in der Tabelle smtppro_email_log protokollieren. Das Protokoll kann im Backend unter System->Werkzeuge->E-Mail-Protokoll eingesehen werden."
|
14 |
-
"Run Self Test","Selbsttest durchführen"
|
15 |
-
"This test will ensure the configuration in your Google Apps/ Gmail OR SMTP section are working. You have to save the settings from either of these sections before running this test.","Dieser Test wird sicherstellen, dass die Konfiguration im Google-Apps/Gmail- oder SMTP-Abschnitt korrekt ist. Vor dem Test müssen die Einstellungen in diesen Abschnitten gespeichert werden."
|
16 |
-
"SMTP Pro Email Google Apps/Gmail Settings","SMTP Pro Email - Google-Apps/Gmail-Einstellungen"
|
17 |
-
"SMTP Pro Email SMTP Settings","SMTP Pro Email - SMTP-Einstellungen"
|
18 |
-
"Authentication","Authentifizierung"
|
19 |
-
"None (ignore username/password)","Keine (ignoriere Benutzername/Passwort)"
|
20 |
-
"This will determine if and how you authenticate with your SMTP server. If you choose no authentication then the username and password below are not used.","Dies legt fest, ob und wie die Authentifizierung am SMTP-Server erfolgen soll. Entfällt die Authentifizierung, werden die Felder für Benutzername und Passwort nicht genutzt."
|
21 |
-
"Username","Benutzername"
|
22 |
-
"If you use Authentication for your SMTP server this is the username used to authenticate.","Bei Verwendung von Authentifizierung am SMTP-Server wird dieser Benutzername zur Anmeldung verwendet"
|
23 |
-
"If you use Authentication for your SMTP server this is the password used to authenticate.","Bei Verwendung von Authentifizierung am SMTP-Server wird dieses Passwort zur Anmeldung verwendet"
|
24 |
-
"This is the SMTP server hostname you would like to send your emails through. This is required.","Der Hostname des SMTP-Servers, über den die E-Mails verschickt werden sollen. Dies ist ein Pflichtfeld"
|
25 |
-
"This is the port on the SMTP server you connect to. The value is optional, it defaults to 25 for none and TLS or 465 for SSL.","Der Port über den der SMTP-Server erreicht werden soll. Dieser Wert ist optional, ohne Angabe wird Port 25 ohne Verschlüsselung oder mit TLS, Port 465 für SSL verwendet"
|
26 |
-
"SSL Security","SSL-Sicherheit"
|
27 |
-
"No SSL","Kein SSL"
|
28 |
-
"This will determine if any SSL security should be used to connect to your SMTP server.","Dies gibt an, welche SSL-Sicherheit für die Verbindung zum SMTP-Server verwendet werden soll."TP server you connect to. The value is optional, it defaults to 25 for none and TLS or 465 for SSL.","Der Port über den der SMTP-Server erreicht werden soll. Dieser Wert ist optional, ohne Angabe wird Port 25 ohne Verschlüsselung oder mit TLS, Port 465 für SSL verwendet"
|
29 |
-
"SSL Security","SSL-Sicherheit"
|
30 |
-
"No SSL","Kein SSL"
|
31 |
-
"This will determine if any SSL security should be used to connect to your SMTP server.","Dies gibt an, welche SSL-Sicherheit für die Verbindung zum SMTP-Server verwe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,50 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ASchroder_SMTPPro</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>This extension
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
<
|
18 |
-

|
19 |
-
1.4.2 - Updated Email_Template to work with Magento 1.5.
|
20 |
-

|
21 |
-
1.4.1 - Missed one place where a non-standard basedir will trip up the self test and add extra exception logging.
|
22 |
-

|
23 |
-
1.4.0 - several bug fixes and update to support Magento 1.4.2
|
24 |
-

|
25 |
-
1.3.3 - For the love of god Magento Connect - please let me upload this!
|
26 |
-

|
27 |
-
1.3.2 - For the love of god Magento Connect - please let me upload this!
|
28 |
-

|
29 |
-
1.3.1 - bug fix for the Observer.php include.
|
30 |
-

|
31 |
-
1.3 - add test of _actual email sending and add From: header on test email (fixes an issue for some SMTP servers)
|
32 |
-

|
33 |
-
1.1.1 - Bug fix release
|
34 |
-

|
35 |
-
1.1.0 - Added email logging and event firing
|
36 |
-

|
37 |
-
1.0.4 - No changes, just adding a new point release in the hope that magento connect will work...
|
38 |
-

|
39 |
-
1.0.3 - No changes, just adding a new point release in the hope that magento connect will work...
|
40 |
-

|
41 |
-
1.0.2 - Add support for multiple gmail or Google Apps accounts to address the 500 email limit Google imposes.
|
42 |
-

|
43 |
-
1.0.1 - Re release of the SMTP Pro extension as a combined SMTP + Google apps/Gmail extension.</notes>
|
44 |
-
<authors><author><name>Ashley Schroder</name><user>auto-converted</user><email>ashley.schroder@gmail.com</email></author></authors>
|
45 |
-
<date>2011-03-20</date>
|
46 |
-
<time>04:24:33</time>
|
47 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="smtppro"><file name="view.phtml" hash="fd22a77c5754913bac050923bff57d95"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Aschroder"><dir name="SMTPPro"><dir name="Block"><dir name="Adminhtml"><file name="Test.php" hash="0d0ff50fe926cd5704426d5a7b255176"/></dir><dir name="Log"><file name="Grid.php" hash="2f04731eeeb9d821857fccda014a6d84"/><file name="View.php" hash="396702d55673f05961cf646525212534"/></dir><file name="Log.php" hash="d2a7233ec0fd3f20d048f3dd412f61a3"/></dir><dir name="Helper"><file name="Data.php" hash="e4ebefdc54df5e440caafa6365534624"/></dir><dir name="Model"><dir name="Email"><file name="Log.php" hash="c05dcbe851684410e0cbcfed6cc914cd"/><file name="Template.php" hash="a234cf2f9fa7d4b9a0e83c52e46e3d0f"/></dir><dir name="Mysql4"><dir name="Email"><dir name="Log"><file name="Collection.php" hash="8ca40c787081eb19f665e8033bfd5025"/></dir><file name="Log.php" hash="c8331530a6744b42c52beaf0e714fddd"/></dir><file name="Setup.php" hash="a1f73ffd26ddd42a9789b071a40b2450"/></dir><dir name="Newsletter"><file name="Template.php" hash="b38356df77253bd116ee5b6f6c59b223"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Smtp"><file name="Authentication.php" hash="2e871d8a7a4beaff99c818a51fb38344"/><file name="Development.php" hash="2f9b6177e6063c2d42483c9af65995d3"/><file name="Option.php" hash="a4335eb0c2bc92c6a3356dd62fc568ff"/><file name="Ssl.php" hash="ae9af390a40b8bcebbc8451a9152821f"/></dir></dir></dir></dir><file name="Email.php" hash="043689ad6ac3bfa6c96739596126fd20"/><file name="Observer.php" hash="a9df4366354e355bfdb1476720610331"/></dir><dir name="controllers"><file name="IndexController.php" hash="63dcb8c38abd84e4996abb49e6b5d543"/><file name="LogController.php" hash="b6819bb30738db7416ca241303e5b1fd"/></dir><dir name="etc"><file name="config.xml" hash="512a199b1e4092c9051582afa648cce2"/><file name="system.xml" hash="9f4b9a8f2e59de0b3fd6b28c9a49b1d7"/></dir><dir name="lib"><file name="AmazonSES.php" hash="64e65ec97f0f2e3e72d132ed612fb858"/></dir><dir name="locale"><dir name="de_DE"><file name="Aschroder_SMTPPro.csv" hash="5b2e576a73cc62cfaf3ffc61d5149bb8"/></dir></dir><dir name="modules"><file name="Aschroder_SMTPPro.xml" hash="8a4e6872dd721b6bd17bce8b1cb11769"/></dir><dir name="sql"><dir name="smtppro_setup"><file name="mysql4-install-1.1.0.php" hash="5c13c266d15ce411658ae616c3e41e63"/></dir></dir><dir name="templates"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="smtppro"><file name="view.phtml" hash="fd22a77c5754913bac050923bff57d95"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aschroder_SMTPPro.xml" hash="8a4e6872dd721b6bd17bce8b1cb11769"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Aschroder_SMTPPro.csv" hash="5b2e576a73cc62cfaf3ffc61d5149bb8"/></dir></target></contents>
|
48 |
<compatible/>
|
49 |
-
<dependencies
|
50 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ASchroder_SMTPPro</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Robust, Free and Open Source SMTP, Gmail, SendGrid and Google Apps Email support for Magento</summary>
|
10 |
+
<description>This extension provides complete control of Email settings for Magento. It can send with any custom SMTP server, your GMail or Google Apps account</description>
|
11 |
+
<notes>2.0.0 - Version 2 is a complete rewrite and refresh of the extension. Full support for newer versions of Magento.
|
12 |
+

|
13 |
+
As of 2014 - All prior releases available on github, but no longer supported.</notes>
|
14 |
+
<authors><author><name>ASchroder</name><user>ashleys22</user><email>ashley.schroder@gmail.com</email></author></authors>
|
15 |
+
<date>2014-05-01</date>
|
16 |
+
<time>11:48:14</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Aschroder"><dir name="SMTPPro"><dir name="Block"><dir name="Adminhtml"><file name="Table.php" hash="b1ce1d8c837b32e5b6ebc947a837e99d"/><file name="Test.php" hash="392fe708a973b6fdd3e4d8d8af2aeb70"/></dir><dir name="Log"><file name="Grid.php" hash="e15ba1de3a2d09ff12f3f7bff6fcde10"/><file name="View.php" hash="396702d55673f05961cf646525212534"/></dir><file name="Log.php" hash="d2a7233ec0fd3f20d048f3dd412f61a3"/></dir><dir name="Helper"><file name="Data.php" hash="4f1537614a0df30c1cfba463b4d01080"/><dir name="Mysql4"><file name="Install.php" hash="4debbbeb4e2978c28685145edc1b2caa"/></dir></dir><dir name="Model"><dir name="Email"><file name="Log.php" hash="c099f9c0b7e0d19c951ac2b6f889bbf3"/><file name="Template.php" hash="754a3ec71cc4f66509a40e3568250eff"/></dir><file name="Email.php" hash="5c1dd2d775c4069c541a22b64bcf51bc"/><dir name="Mysql4"><dir name="Email"><dir name="Log"><file name="Collection.php" hash="8ca40c787081eb19f665e8033bfd5025"/></dir><file name="Log.php" hash="f96a10f9d4de72dffb278adced8647c4"/></dir><file name="Setup.php" hash="a1f73ffd26ddd42a9789b071a40b2450"/></dir><file name="Observer.php" hash="5aa51e49e2535f5d7a7414d988586b6a"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Smtp"><file name="Authentication.php" hash="ed63c8a65c817ece5ea5c56fe470b75e"/><file name="Development.php" hash="2f9b6177e6063c2d42483c9af65995d3"/><file name="Option.php" hash="ec87644abbcd4cacec1c745416df30a1"/><file name="Ssl.php" hash="ae9af390a40b8bcebbc8451a9152821f"/></dir></dir></dir></dir><dir name="Transports"><file name="Basesmtp.php" hash="b39db5c094b60e3628ee087d47c9e7c1"/><file name="Disabled.php" hash="cf6545e7e696c536ba3aef76b7edadf3"/><file name="Google.php" hash="66efa5bdb12f5fecf68077cd9fd0de4e"/><file name="Sendgrid.php" hash="f5ea76686a1a37c9b1417cb67455a576"/><file name="Ses.php" hash="eacd94561ec46594a1a14fc9d12a4c89"/><file name="Smtp.php" hash="8e60c0ca9d6f68a8c606831273a2b545"/></dir></dir><dir name="controllers"><file name="LogController.php" hash="b6819bb30738db7416ca241303e5b1fd"/><file name="TestController.php" hash="884367d14631ce3090862509156a1ba7"/></dir><dir name="etc"><file name="config.xml" hash="2c106ee99507cca6e502e36c2427c22c"/><file name="system.xml" hash="0e4968c0e7d3f3e7f7ef4068bb805ed5"/></dir><dir name="lib"><file name="AmazonSES.php" hash="487803f8f337e780a3284606363a0ce8"/></dir><dir name="sql"><dir name="smtppro_setup"><file name="mysql4-install-1.1.0.php" hash="344225e3f373f0c4f6c506cdb84c088f"/><file name="mysql4-upgrade-1.4.3-1.4.4.php" hash="b91bf0f951390b1d1da7f54d36e5cb0a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="smtppro"><file name="view.phtml" hash="6a6c558348b5205e8dd9ebbd265c47bc"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aschroder_SMTPPro.xml" hash="23c719e9ecb45c14d29ab24d3e2bd7a1"/></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|