ASchroder_SMTPPro - Version 2.0.0

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

Files changed (50) hide show
  1. app/code/community/Aschroder/SMTPPro/Block/Adminhtml/Test.php +0 -48
  2. app/code/community/Aschroder/SMTPPro/Helper/Data.php +0 -152
  3. app/code/community/Aschroder/SMTPPro/Model/Email.php +0 -95
  4. app/code/community/Aschroder/SMTPPro/Model/Email/Template.php +0 -130
  5. app/code/community/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php +0 -17
  6. app/code/community/Aschroder/SMTPPro/Model/Newsletter/Template.php +0 -141
  7. app/code/community/Aschroder/SMTPPro/Model/Observer.php +0 -34
  8. app/code/community/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php +0 -20
  9. app/code/community/Aschroder/SMTPPro/controllers/IndexController.php +0 -181
  10. app/code/community/Aschroder/SMTPPro/etc/config.xml +0 -146
  11. app/code/community/Aschroder/SMTPPro/etc/system.xml +0 -189
  12. app/code/community/Aschroder/SMTPPro/locale/de_DE/Aschroder_SMTPPro.csv +0 -31
  13. app/code/community/Aschroder/SMTPPro/modules/Aschroder_SMTPPro.xml +0 -9
  14. app/code/community/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php +0 -30
  15. app/code/community/Aschroder/SMTPPro/templates/adminhtml/base/default/template/smtppro/view.phtml +0 -27
  16. app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Table.php +20 -0
  17. app/code/local/Aschroder/SMTPPro/Block/Adminhtml/Test.php +52 -0
  18. app/code/{community → local}/Aschroder/SMTPPro/Block/Log.php +0 -0
  19. app/code/{community → local}/Aschroder/SMTPPro/Block/Log/Grid.php +3 -3
  20. app/code/{community → local}/Aschroder/SMTPPro/Block/Log/View.php +0 -0
  21. app/code/local/Aschroder/SMTPPro/Helper/Data.php +172 -0
  22. app/code/local/Aschroder/SMTPPro/Helper/Mysql4/Install.php +256 -0
  23. app/code/local/Aschroder/SMTPPro/Model/Email.php +62 -0
  24. app/code/{community → local}/Aschroder/SMTPPro/Model/Email/Log.php +12 -0
  25. app/code/local/Aschroder/SMTPPro/Model/Email/Template.php +130 -0
  26. app/code/local/Aschroder/SMTPPro/Model/Mysql4/Email/Log.php +60 -0
  27. app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Email/Log/Collection.php +0 -0
  28. app/code/{community → local}/Aschroder/SMTPPro/Model/Mysql4/Setup.php +0 -0
  29. app/code/local/Aschroder/SMTPPro/Model/Observer.php +64 -0
  30. app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Authentication.php +1 -1
  31. app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Development.php +0 -0
  32. app/code/local/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Option.php +22 -0
  33. app/code/{community → local}/Aschroder/SMTPPro/Model/System/Config/Source/Smtp/Ssl.php +0 -0
  34. app/code/local/Aschroder/SMTPPro/Model/Transports/Basesmtp.php +39 -0
  35. app/code/local/Aschroder/SMTPPro/Model/Transports/Disabled.php +17 -0
  36. app/code/local/Aschroder/SMTPPro/Model/Transports/Google.php +31 -0
  37. app/code/local/Aschroder/SMTPPro/Model/Transports/Sendgrid.php +31 -0
  38. app/code/local/Aschroder/SMTPPro/Model/Transports/Ses.php +38 -0
  39. app/code/local/Aschroder/SMTPPro/Model/Transports/Smtp.php +31 -0
  40. app/code/{community → local}/Aschroder/SMTPPro/controllers/LogController.php +0 -0
  41. app/code/local/Aschroder/SMTPPro/controllers/TestController.php +256 -0
  42. app/code/local/Aschroder/SMTPPro/etc/config.xml +192 -0
  43. app/code/local/Aschroder/SMTPPro/etc/system.xml +254 -0
  44. app/code/{community → local}/Aschroder/SMTPPro/lib/AmazonSES.php +2 -2
  45. app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-install-1.1.0.php +32 -0
  46. app/code/local/Aschroder/SMTPPro/sql/smtppro_setup/mysql4-upgrade-1.4.3-1.4.4.php +21 -0
  47. app/design/adminhtml/default/default/template/smtppro/view.phtml +1 -1
  48. app/etc/modules/Aschroder_SMTPPro.xml +1 -1
  49. app/locale/de_DE/Aschroder_SMTPPro.csv +0 -31
  50. 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 &lt;a href='http://aschroder.com' target='_blank'&gt;ASchroder.com&lt;/a&gt;.</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 &lt;a href='http://aschroder.com' target='_blank'&gt;ASchroder.com&lt;/a&gt;.","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 &lt;a href='http://aschroder.com' target='_blank'&gt;ASchroder.com&lt;/a&gt;. "
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">&laquo; <?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