Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set reply_to equal to report creator. #331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/global.ini.php
Expand Up @@ -280,6 +280,9 @@
; when testing, use your own email address or "nobody"
feedback_email_address = "feedback@piwik.org"

; using to set reply_to in reports e-mail to login of report creator
scheduled_reports_replyto_is_user_email_and_alias = 0

; during archiving, Piwik will limit the number of results recorded, for performance reasons
; maximum number of rows for any of the Referrers tables (keywords, search engines, campaigns, etc.)
datatable_archiving_maximum_rows_referrers = 1000
Expand Down
16 changes: 16 additions & 0 deletions plugins/ScheduledReports/ScheduledReports.php
Expand Up @@ -16,10 +16,12 @@
use Piwik\Piwik;
use Piwik\Plugins\MobileMessaging\MobileMessaging;
use Piwik\Plugins\UsersManager\API as APIUsersManager;
use Piwik\Plugins\UsersManager\Model as UserModel;
use Piwik\ReportRenderer;
use Piwik\ScheduledTime;
use Piwik\View;
use Zend_Mime;
use Piwik\Config;

/**
*
Expand Down Expand Up @@ -267,6 +269,8 @@ public function sendReport($reportType, $report, $contents, $filename, $prettyDa
$mail->setSubject($subject);
$attachmentName = $subject;

$this->setReplyToAsSender($mail, $report);

$displaySegmentInfo = false;
$segmentInfo = null;
$segment = API::getSegment($report['idsegment']);
Expand Down Expand Up @@ -602,4 +606,16 @@ static public function getPeriodToFrequencyAsAdjective()
ScheduledTime::PERIOD_RANGE => Piwik::translate('General_RangeReports'),
);
}

protected function setReplyToAsSender(Mail $mail, array $report)
{
if (Config::getInstance()->General['scheduled_reports_replyto_is_user_email_and_alias']) {
if (isset($report['login'])) {
$userModel = new UserModel();
$user = $userModel->getUser($report['login']);

$mail->setReplyTo($user['email'], $user['alias']);
}
}
}
}