Version Notes
N/A
Download this release
Release Info
Developer | Magento Core Team |
Extension | ArtsOnIT_AdvancedSmtp |
Version | 0.1.5 |
Comparing to | |
See all releases |
Version 0.1.5
- app/code/community/Mage/Advancedsmtp/Helper/Data.php +33 -0
- app/code/community/Mage/Advancedsmtp/Model/Config/Source/Auth.php +14 -0
- app/code/community/Mage/Advancedsmtp/Model/Email.php +41 -0
- app/code/community/Mage/Advancedsmtp/Model/Email/Template.php +61 -0
- app/code/community/Mage/Advancedsmtp/etc/config.xml +72 -0
- app/code/community/Mage/Advancedsmtp/etc/system.xml +84 -0
- package.xml +18 -0
app/code/community/Mage/Advancedsmtp/Helper/Data.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento ArtsOnIt Advanced Smtp
|
4 |
+
*
|
5 |
+
* @category ArtsOnIt
|
6 |
+
* @package Mage_AdvanceSmtp
|
7 |
+
* @copyright Copyright (c) 2008 ArtsOn.IT(http://www.ArtsOn.it)
|
8 |
+
* @author Calore Luca Erico (l.calore@ArtsOn.it)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Mage_Advancedsmtp_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
public function getTransport()
|
14 |
+
{
|
15 |
+
$config = array(
|
16 |
+
'port' => Mage::getStoreConfig('advancedsmtp/settings/port')
|
17 |
+
);
|
18 |
+
$config_auth = Mage::getStoreConfig('advancedsmtp/settings/auth');
|
19 |
+
if ($config_auth != 'none')
|
20 |
+
{
|
21 |
+
$config['auth'] = $config_auth;
|
22 |
+
$config['username'] = Mage::getStoreConfig('advancedsmtp/settings/username');
|
23 |
+
$config['password'] = Mage::getStoreConfig('advancedsmtp/settings/password');
|
24 |
+
}
|
25 |
+
if (Mage::getStoreConfig('advancedsmtp/settings/ssl'))
|
26 |
+
{
|
27 |
+
$config['ssl'] = 'tls';
|
28 |
+
}
|
29 |
+
$transport = new Zend_Mail_Transport_Smtp(Mage::getStoreConfig('advancedsmtp/settings/host'), $config);
|
30 |
+
return $transport;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
app/code/community/Mage/Advancedsmtp/Model/Config/Source/Auth.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mage_AdvancedSmtp_Model_Config_Source_Auth
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value'=>'none', 'label'=>'None'),
|
9 |
+
array('value'=>'plain', 'label'=>'Plain'),
|
10 |
+
array('value'=>'login', 'label'=>'Login'),
|
11 |
+
array('value'=>'crammd5', 'label'=>'CRAM-MD5'),
|
12 |
+
);
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Mage/Advancedsmtp/Model/Email.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento ArtsOnIt Advanced Smtp
|
4 |
+
*
|
5 |
+
* @category ArtsOnIt
|
6 |
+
* @package Mage_AdvanceSmtp
|
7 |
+
* @copyright Copyright (c) 2008 ArtsOn.IT(http://www.ArtsOn.it)
|
8 |
+
* @author Calore Luca Erico (l.calore@ArtsOn.it)
|
9 |
+
*/
|
10 |
+
class Mage_Advancedsmtp_Model_Email extends Mage_Core_Model_Email
|
11 |
+
{
|
12 |
+
public function send()
|
13 |
+
{
|
14 |
+
if (!Mage::getStoreConfig('advancedsmtp/settings/enabled'))
|
15 |
+
{
|
16 |
+
return parent::send();
|
17 |
+
}
|
18 |
+
|
19 |
+
if (Mage::getStoreConfigFlag('system/smtp/disable')) {
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
$mail = new Zend_Mail();
|
24 |
+
|
25 |
+
if (strtolower($this->getType()) == 'html') {
|
26 |
+
$mail->setBodyHtml($this->getBody());
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
$mail->setBodyText($this->getBody());
|
30 |
+
}
|
31 |
+
$transport = Mage::helper('advancedsmtp')->getTransport();
|
32 |
+
$mail->setFrom($this->getFromEmail(), $this->getFromName())
|
33 |
+
->addTo($this->getToEmail(), $this->getToName())
|
34 |
+
->setSubject($this->getSubject());
|
35 |
+
|
36 |
+
|
37 |
+
$mail->send($transport);
|
38 |
+
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Mage/Advancedsmtp/Model/Email/Template.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento ArtsOnIt Advanced Smtp
|
4 |
+
*
|
5 |
+
* @category ArtsOnIt
|
6 |
+
* @package Mage_AdvanceSmtp
|
7 |
+
* @copyright Copyright (c) 2008 ArtsOn.IT(http://www.ArtsOn.it)
|
8 |
+
* @author Calore Luca Erico (l.calore@ArtsOn.it)
|
9 |
+
*/
|
10 |
+
class Mage_Advancedsmtp_Model_Email_Template extends Mage_Core_Model_Email_Template
|
11 |
+
{
|
12 |
+
public function send($email, $name=null, array $variables = array())
|
13 |
+
{
|
14 |
+
if (!Mage::getStoreConfig('advancedsmtp/settings/enabled'))
|
15 |
+
{
|
16 |
+
return parent::send($email, $name, $variables);
|
17 |
+
}
|
18 |
+
if(!$this->isValidForSend()) {
|
19 |
+
return false;
|
20 |
+
}
|
21 |
+
|
22 |
+
if (is_null($name)) {
|
23 |
+
$name = substr($email, 0, strpos($email, '@'));
|
24 |
+
}
|
25 |
+
|
26 |
+
$variables['email'] = $email;
|
27 |
+
$variables['name'] = $name;
|
28 |
+
|
29 |
+
$mail = $this->getMail();
|
30 |
+
if (is_array($email)) {
|
31 |
+
foreach ($email as $emailOne) {
|
32 |
+
$mail->addTo($emailOne, $name);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$mail->addTo($email, $name);
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->setUseAbsoluteLinks(true);
|
40 |
+
$text = $this->getProcessedTemplate($variables, true);
|
41 |
+
|
42 |
+
if($this->isPlain()) {
|
43 |
+
$mail->setBodyText($text);
|
44 |
+
} else {
|
45 |
+
$mail->setBodyHTML($text);
|
46 |
+
}
|
47 |
+
|
48 |
+
$mail->setSubject($this->getProcessedTemplateSubject($variables));
|
49 |
+
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
50 |
+
|
51 |
+
$transport = Mage::helper('advancedsmtp')->getTransport();
|
52 |
+
try {
|
53 |
+
$mail->send($transport); // Zend_Mail warning..
|
54 |
+
$this->_mail = null;
|
55 |
+
}
|
56 |
+
catch (Exception $e) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
return true;
|
60 |
+
}
|
61 |
+
}
|
app/code/community/Mage/Advancedsmtp/etc/config.xml
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento ArtsOnIt Advanced Smtp
|
5 |
+
*
|
6 |
+
* @category ArtsOnIt
|
7 |
+
* @package Mage_AdvanceSmtp
|
8 |
+
* @copyright Copyright (c) 2008 ArtsOn.IT(http://www.ArtsOn.it)
|
9 |
+
* @author Calore Luca Erico (l.calore@ArtsOn.it)
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<Mage_Advancesmtp>
|
15 |
+
<version>0.1.5</version>
|
16 |
+
</Mage_Advancesmtp>
|
17 |
+
</modules>
|
18 |
+
<global>
|
19 |
+
<models>
|
20 |
+
<core>
|
21 |
+
<rewrite>
|
22 |
+
<email_template>Mage_Advancedsmtp_Model_Email_Template</email_template>
|
23 |
+
<email>Mage_Advancedsmtp_Model_Email</email>
|
24 |
+
</rewrite>
|
25 |
+
</core>
|
26 |
+
</models>
|
27 |
+
</global>
|
28 |
+
<adminhtml>
|
29 |
+
<translate>
|
30 |
+
<modules>
|
31 |
+
<Mage_Advancedsmtp>
|
32 |
+
<files>
|
33 |
+
<default>Mage_AdvanceSmtp.csv</default>
|
34 |
+
</files>
|
35 |
+
</Mage_Advancedsmtp>
|
36 |
+
</modules>
|
37 |
+
</translate>
|
38 |
+
<acl>
|
39 |
+
<resources>
|
40 |
+
<admin>
|
41 |
+
<children>
|
42 |
+
<system>
|
43 |
+
<children>
|
44 |
+
<config>
|
45 |
+
<children>
|
46 |
+
<advancedsmtp>
|
47 |
+
<title>Advanced Smtp Settings</title>
|
48 |
+
</advancedsmtp>
|
49 |
+
</children>
|
50 |
+
</config>
|
51 |
+
</children>
|
52 |
+
</system>
|
53 |
+
</children>
|
54 |
+
</admin>
|
55 |
+
</resources>
|
56 |
+
</acl>
|
57 |
+
</adminhtml>
|
58 |
+
|
59 |
+
<default>
|
60 |
+
<advancedsmtp>
|
61 |
+
<settings>
|
62 |
+
<enabled>0</enabled>
|
63 |
+
<auth>login</auth>
|
64 |
+
<username></username>
|
65 |
+
<password></password>
|
66 |
+
<ssl>0</ssl>
|
67 |
+
<host>localhost</host>
|
68 |
+
<port>25</port>
|
69 |
+
</settings>
|
70 |
+
</advancedsmtp>
|
71 |
+
</default>
|
72 |
+
</config>
|
app/code/community/Mage/Advancedsmtp/etc/system.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<sections>
|
3 |
+
<advancedsmtp translate="label" module="advancedsmtp">
|
4 |
+
<label>Advanced Smtp Settings</label>
|
5 |
+
<tab>advanced</tab>
|
6 |
+
<frontend_type>text</frontend_type>
|
7 |
+
<sort_order>990</sort_order>
|
8 |
+
<show_in_default>1</show_in_default>
|
9 |
+
<show_in_website>1</show_in_website>
|
10 |
+
<show_in_store>0</show_in_store>
|
11 |
+
<groups>
|
12 |
+
<settings translate="label">
|
13 |
+
<label>Settings</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>0</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<enabled translate="label">
|
21 |
+
<label>Enable Advanced Smtp</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
</enabled>
|
29 |
+
<auth translate="label">
|
30 |
+
<label>Auth Mode</label>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>advancedsmtp/config_source_auth</source_model>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</auth>
|
38 |
+
<username translate="label">
|
39 |
+
<label>Username</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>3</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>0</show_in_store>
|
45 |
+
</username>
|
46 |
+
<password translate="label">
|
47 |
+
<label>Password</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>4</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>0</show_in_store>
|
53 |
+
</password>
|
54 |
+
<host translate="label">
|
55 |
+
<label>Smtp host</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>5</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>0</show_in_store>
|
61 |
+
</host>
|
62 |
+
<port translate="label">
|
63 |
+
<label>Smtp port</label>
|
64 |
+
<frontend_type>text</frontend_type>
|
65 |
+
<sort_order>6</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>0</show_in_store>
|
69 |
+
</port>
|
70 |
+
<ssl translate="label">
|
71 |
+
<label>Use SSL</label>
|
72 |
+
<frontend_type>select</frontend_type>
|
73 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
74 |
+
<sort_order>7</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>0</show_in_store>
|
78 |
+
</ssl>
|
79 |
+
</fields>
|
80 |
+
</settings>
|
81 |
+
</groups>
|
82 |
+
</advancedsmtp>
|
83 |
+
</sections>
|
84 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ArtsOnIT_AdvancedSmtp</name>
|
4 |
+
<version>0.1.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>N/A</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Provide the support for all the smpt server (Autentication, SSL)</summary>
|
10 |
+
<description>Provide the support for all the smpt server (Autentication, SSL)</description>
|
11 |
+
<notes>N/A</notes>
|
12 |
+
<authors><author><name>Luca</name><user>auto-converted</user><email>me@ziq.it</email></author></authors>
|
13 |
+
<date>2008-08-04</date>
|
14 |
+
<time>04:54:04</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Mage"><dir name="Advancedsmtp"><dir name="etc"><file name="config.xml" hash="6f90c9f11843eec1d576e0e280a1dbfe"/><file name="system.xml" hash="99e751cdcdb75c42385e3d516f5ebacc"/></dir><dir name="Helper"><file name="Data.php" hash="cbe9dd2a4a39b1e855e1264836bae4e2"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Auth.php" hash="153d45ac9508e4d53a77926c31af07ea"/></dir></dir><dir name="Email"><file name="Template.php" hash="cf435dec38a9019c2756065f31281b0b"/></dir><file name="Email.php" hash="3284938017185e0c1c26f5b79dfca6dd"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|