diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-03-11 08:02:55 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-03-11 08:02:55 +0400 |
commit | bac1b856bbabd3f73965edd7b9909db26e847cc4 (patch) | |
tree | 9cc3458e328db63fe478265bfd734c0f13004d68 | |
parent | 301129f6e1d03ce57a215f119d7ce46963a6167a (diff) |
Set default From: header in emails sent from Piwik.
This will fix the Custom Alerts missing From header.
-rw-r--r-- | core/Mail.php | 12 | ||||
-rw-r--r-- | plugins/ScheduledReports/ScheduledReports.php | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/core/Mail.php b/core/Mail.php index 09a3936a36..ee3098dd92 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -8,6 +8,7 @@ */ namespace Piwik; +use Piwik\Plugins\CoreAdminHome\CustomLogo; use Zend_Mail; /** @@ -28,6 +29,17 @@ class Mail extends Zend_Mail { parent::__construct($charset); $this->initSmtpTransport(); + $this->setDefaultFrom(); + } + + private function setDefaultFrom() + { + $customLogo = new CustomLogo(); + $fromEmailName = $customLogo->isEnabled() + ? Piwik::translate('CoreHome_WebAnalyticsReports') + : Piwik::translate('ScheduledReports_PiwikReports'); + $fromEmailAddress = Config::getInstance()->General['noreply_email_address']; + $this->setFrom($fromEmailAddress, $fromEmailName); } /** diff --git a/plugins/ScheduledReports/ScheduledReports.php b/plugins/ScheduledReports/ScheduledReports.php index cb2309b5ce..38fa35fcf7 100644 --- a/plugins/ScheduledReports/ScheduledReports.php +++ b/plugins/ScheduledReports/ScheduledReports.php @@ -274,13 +274,7 @@ class ScheduledReports extends \Piwik\Plugin $mail = new Mail(); $mail->setSubject($subject); - $customLogo = new CustomLogo(); - $fromEmailName = $customLogo->isEnabled() - ? Piwik::translate('CoreHome_WebAnalyticsReports') - : Piwik::translate('ScheduledReports_PiwikReports'); - $fromEmailAddress = Config::getInstance()->General['noreply_email_address']; $attachmentName = $subject; - $mail->setFrom($fromEmailAddress, $fromEmailName); $displaySegmentInfo = false; $segmentInfo = null; |