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-23 23:23:51 +0400
committermattpiwik <matthieu.aubry@gmail.com>2010-07-23 23:23:51 +0400
commitba603c67351452df7092fc49e68ca3691718c96e (patch)
treea7860c07daf96ef9c15b33860c4e3a5e4df1a6f6 /core/Mail.php
parent08f6047a5de9af46cb72b8c8486549738375c2cb (diff)
Fixes issue with Goals API throwing errors when called with lastX
git-svn-id: http://dev.piwik.org/svn/trunk@2643 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Mail.php')
-rw-r--r--core/Mail.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/Mail.php b/core/Mail.php
index 8daf4d2be7..625b067585 100644
--- a/core/Mail.php
+++ b/core/Mail.php
@@ -27,5 +27,48 @@ class Piwik_Mail extends Zend_Mail
public function __construct($charset = 'utf-8')
{
parent::__construct($charset);
+ $this->setTransport();
+ }
+
+
+ public function setTransport()
+ {
+ try
+ {
+ $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");
+ }
+ }
+ catch(Exception $e)
+ {
+ throw new Exception("Configuration SMTP error");
+ }
+
}
}