HE_DevTools_EmailRedirect - Version 1.0.0

Version Notes

This is the first release

Download this release

Release Info

Developer Greg Croasdill
Extension HE_DevTools_EmailRedirect
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/HEDevTools/EmailRedirect/.DS_Store ADDED
Binary file
app/code/community/HEDevTools/EmailRedirect/Model/.DS_Store ADDED
Binary file
app/code/community/HEDevTools/EmailRedirect/Model/Email/Info.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: greg c
5
+ * Date: 12/18/12
6
+ * Time: 2:40 PM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class HEDevTools_EmailRedirect_Model_Email_Info extends Mage_Core_Model_Email_Info
10
+ {
11
+ /**
12
+ * Add new "To" recipient to current email
13
+ *
14
+ * @param string $email
15
+ * @param string|null $name
16
+ * @return Mage_Core_Model_Email_Info
17
+ */
18
+
19
+ public function addTo($email, $name = null)
20
+ {
21
+ Mage::log("Email Redirect - testing $email ",null,"he_devtools.log");
22
+
23
+ $enabled = Mage::getStoreConfig('he_dev_tools/email_redirect/enable');
24
+ $safeDomains = Mage::getStoreConfig('he_dev_tools/email_redirect/safe_domains');
25
+ $redirectEmail = Mage::getStoreConfig('he_dev_tools/email_redirect/redirect_to');
26
+
27
+ if ($enabled && $safeDomains && $redirectEmail) {
28
+ $email_item = explode("@", $email);
29
+ if (strpos( $safeDomains , $email_item[1]) === false ) {
30
+ $origEmail = $email;
31
+ $email = $redirectEmail;
32
+
33
+ Mage::log("Email Redirect - $origEmail not in allowed domain, redirecting email to $email ",null,"he_devtools.log");
34
+ }
35
+ }
36
+
37
+ return parent::addTo($email, $name);
38
+ }
39
+ }
app/code/community/HEDevTools/EmailRedirect/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <he_dev_tools translate="title">
12
+ <title>HE Dev Tools</title>
13
+ <sort_order>999</sort_order>
14
+ </he_dev_tools>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/HEDevTools/EmailRedirect/etc/config.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <HEDevTools_EmailRedirect>
6
+ <version>1.0.0</version>
7
+ </HEDevTools_EmailRedirect>
8
+ </modules>
9
+ <global>
10
+ <models>
11
+ <he_tools>
12
+ <class>HEDevTools_EmailRedirect_Model</class>
13
+ </he_tools>
14
+ <core>
15
+ <rewrite>
16
+ <email_info>HEDevTools_EmailRedirect_Model_Email_Info</email_info>
17
+ </rewrite>
18
+ </core>
19
+ </models>
20
+ </global>
21
+ </config>
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
app/code/community/HEDevTools/EmailRedirect/etc/system.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <human_element_dev translate="label">
5
+ <label>Human Element Dev Tools</label>
6
+ <sort_order>999999</sort_order>
7
+ </human_element_dev>
8
+ </tabs>
9
+ <sections>
10
+ <he_dev_tools translate="label">
11
+ <label>Route Customer Email</label>
12
+ <tab>human_element_dev</tab>
13
+ <sort_order>10</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+
17
+ <groups>
18
+ <email_redirect translate="label">
19
+ <label>Settings</label>
20
+ <expanded>1</expanded>
21
+ <sort_order>100</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <fields>
25
+ <enable translate="label">
26
+ <label>Enable email redirects</label>
27
+ <frontend_type>select</frontend_type>
28
+ <source_model>adminhtml/system_config_source_yesno</source_model>
29
+ <sort_order>10</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <comment>
33
+ <![CDATA[Enable the email redirect service.]]>
34
+ </comment>
35
+ </enable>
36
+
37
+ <safe_domains translate="label">
38
+ <label>Allowed domains</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <comment>
44
+ <![CDATA[Safe email domain(s) - use a comma separeted list for multiple domains. At least one entry is required for the module to operate.]]>
45
+ </comment>
46
+ </safe_domains>
47
+ <redirect_to translate="label">
48
+ <label>Route all customer email to</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>15</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <validate>validate-email</validate>
54
+ <comment>
55
+ <![CDATA[Email address to re-route all the email to if not in the above domain(s). This is required for the module to operate.]]>
56
+ </comment>
57
+ </redirect_to>
58
+ </fields>
59
+ </email_redirect>
60
+ </groups>
61
+ </he_dev_tools>
62
+ </sections>
63
+ </config>
app/etc/modules/HEDevTools_EmailRedirect.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <HEDevTools_EmailRedirect>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </HEDevTools_EmailRedirect>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>HE_DevTools_EmailRedirect</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>HE Dev Tools Email Redirect allows a developer to redirect all email from a Magento store to a specific address.</summary>
10
+ <description>When maintaining a Magento store, developers often need to copy the database from the live site to a development server. Once the live data is installed in the dev environment, you need to be absolutely certain that customer emails are not accidentally sent from the development environment. This can cause a lot of confusion for clients and customers.&#xD;
11
+ &#xD;
12
+ Using Magento&#x2019;s configuration settings you can block all email from being sent by disabling email sending. This setting is found in System Configuration menu under Advanced/System/Mail Sending Settings. This method is an all or nothing way to solve the problem. However it's not always practical, because you may want to send mail to test the mail templates or some other e-mail related functionality.&#xD;
13
+ &#xD;
14
+ So this is where the new Human Element Dev Tools module Route Customer E-mail comes into play.&#xD;
15
+ &#xD;
16
+ With this module, you can tell Magento which domain names it's OK to send e-mail to (i.e. the domains of your company and your client) and where to route all other customer e-mails (i.e. a testing email address). &#xD;
17
+ &#xD;
18
+ The interface is simple system configuration panel which should appear near the Advanced settings section at the bottom of the configurations list. &#xD;
19
+ &#xD;
20
+ To set up the redirects, just follow these simple steps &#x2013;&#xD;
21
+ &#xD;
22
+ 1) Open up the Route Customer Email panel and enable the Email Redirects&#xD;
23
+ 2) In Allowed |Domain names field you specify which domain names it's OK to send e-mails to. This can be a single domain or a comma separated list. &#xD;
24
+ 3) In the last field enter the one e-mail address where all other e-mails will be re-routed (if they're not sent to someone in the allowed domain names list).&#xD;
25
+ &#xD;
26
+ Once enabled and setup with both fields (note &#x2013; you must enter data in both the Allowed Domains and the Route Email fields for the module to operate) any e-mails Magento sends to addresses that are not in the allowed domain name list are redirected to the entered e-mail address.&#xD;
27
+ &#xD;
28
+ When you're done using the redirector, simply disable it by setting Enable email redirects drop-down to No. When the module is disabled, e-mail function will return to normal.&#xD;
29
+ &#xD;
30
+ To uninstall the module simply remove it from the Magenta file system. This module makes no modifications to the database and can safely deleted without any other changes to Magento.</description>
31
+ <notes>This is the first release</notes>
32
+ <authors><author><name>Human Element</name><user>groggu</user><email>gregc@human-element.com</email></author></authors>
33
+ <date>2012-12-19</date>
34
+ <time>17:13:29</time>
35
+ <contents><target name="magecommunity"><dir name="HEDevTools"><dir name="EmailRedirect"><dir name="Model"><dir name="Email"><file name="Info.php" hash="05030e98bfc8e5257827723c69f733f0"/></dir><file name=".DS_Store" hash="d136742f2bad94642296b912e18664c2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="fe9cfe4c68a745615e8547d365a87850"/><file name="config.xml" hash="c708ecc91dc3c865cee175d3569b77b9"/><file name="system.xml" hash="16ad3e509488175e8d3ee068ad2a4230"/></dir><file name=".DS_Store" hash="4e6e62c49783e7e971f145ce1087df2d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HEDevTools_EmailRedirect.xml" hash="6803e2b48702d458de52e1f19f064eaf"/></dir></target></contents>
36
+ <compatible/>
37
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
38
+ </package>