Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2010-07-24 20:48:45 +0400
committermattpiwik <matthieu.aubry@gmail.com>2010-07-24 20:48:45 +0400
commitfeb13838b96f12b3debc12e7ee625a6315659f68 (patch)
treee82ef8806a8300d3fc01eacc1f040884851ae489 /core/Mail.php
parentafb90bb3fc57d29e5b52a175f03049f7c8754768 (diff)
Fixes #1509 - Thanks Jeremy for initial code!
Refs #71 Note: I haven't tested SMTP myself. will require beta tests git-svn-id: http://dev.piwik.org/svn/trunk@2662 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Mail.php')
-rw-r--r--core/Mail.php58
1 files changed, 21 insertions, 37 deletions
diff --git a/core/Mail.php b/core/Mail.php
index 625b067585..f1ee26cba4 100644
--- a/core/Mail.php
+++ b/core/Mail.php
@@ -20,55 +20,39 @@
class Piwik_Mail extends Zend_Mail
{
/**
- * Public constructor, default charset utf-8
- *
+ * Default charset utf-8
* @param string $charset
*/
public function __construct($charset = 'utf-8')
{
parent::__construct($charset);
- $this->setTransport();
+ $this->initSmtpTransport();
}
-
- public function setTransport()
+ private function initSmtpTransport()
{
- try
+ $config = Zend_Registry::get('config')->mail;
+ if ( empty($config->host)
+ || !empty($config->port)
+ || $config->transport != 'smtp')
{
- $config = Zend_Registry::get('config')->mail;
- if ( !empty($config->host)
- && !empty($config->port)
- && strcmp($config->transport,"smtp") ==0
- )
- {
- if ( !empty($config->auth->type)
- || !empty($config->auth->username)
- || !empty($config->auth->password)
- )
- {
- $config_param = array('auth' => $config->auth->type,
- 'username' => $config->auth->username,
- 'password' => $config->auth->password);
- }
-
- $smtp_address = $config->host;
- $smtp_port = $config->port;
- if(isset($config_param))
- {
- $tr = new Zend_Mail_Transport_Smtp("$smtp_address",$config_param);
- }
- else
- {
- $tr = new Zend_Mail_Transport_Smtp("$smtp_address");
- }
- Piwik_Mail::setDefaultTransport($tr);
- ini_set("smtp_port","$smtp_port");
- }
+ return;
}
- catch(Exception $e)
+ $smtpConfig = array();
+ if ( !empty($config->auth->type)
+ || !empty($config->auth->username)
+ || !empty($config->auth->password)
+ )
{
- throw new Exception("Configuration SMTP error");
+ $smtpConfig = array(
+ 'auth' => $config->auth->type,
+ 'username' => $config->auth->username,
+ 'password' => $config->auth->password
+ );
}
+ $tr = new Zend_Mail_Transport_Smtp($config->host,$smtpConfig);
+ Piwik_Mail::setDefaultTransport($tr);
+ ini_set("smtp_port",$config->port);
}
}