Skip to content

Commit

Permalink
Add bounce config as a notification #60
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalkerl committed Nov 14, 2024
1 parent 8dd0115 commit a909a4b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions bounces.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

use core_reportbuilder\system_report_factory;
use tool_emailutils\helper;
use tool_emailutils\reportbuilder\local\systemreports\email_bounces;

require(__DIR__.'/../../../config.php');
Expand All @@ -35,6 +36,17 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('reportbounces', 'tool_emailutils'));

// Render config used for calculating bounce threshold.
[$handlebounces, $minbounces, $bounceratio] = helper::get_bounce_config();
if (empty($handlebounces)) {
echo $OUTPUT->notification(get_string('configmissing', 'tool_emailutils'));
} else {
echo $OUTPUT->notification(get_string('bounceconfig', 'tool_emailutils', [
'minbounces' => $minbounces,
'bounceratio' => $bounceratio,
]), 'info');
}

$report = system_report_factory::create(email_bounces::class, context_system::instance());

echo $report->output();
Expand Down
3 changes: 2 additions & 1 deletion lang/en/tool_emailutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$string['aws_secret_desc'] = 'Your AWS Secret Access Key';
$string['bouncecheckfull'] = 'Are you absolutely sure you want to reset the bounce count for {$a} ?';
$string['bouncecount'] = 'Bounce count';
$string['bounceconfig'] = 'Bounce handling is enabled. Emails will not be sent to addresses with over {$a->minbounces} bounces and a bounce ratio above {$a->bounceratio}. These values can be changed in config.php.';
$string['bounceratio'] = 'Bounce ratio';
$string['bounces'] = 'For a list of bounces, visit {$a} and search for emails ending with ".b.invalid."';
$string['bouncesreset'] = 'Bounces have been reset for the selected users';
Expand All @@ -43,7 +44,7 @@
$string['checkdnspostmastertools'] = 'Check Post master tools';
$string['checkdnsspf'] = 'DNS Email SPF check';
$string['complaints'] = 'For a list of complaints, search for ".c.invalid"';
$string['configmissing'] = 'Missing config.php setting ($CFG->handlebounces) please review config-dist.php for more information.';
$string['configmissing'] = 'Bounce handling is not enabled as $CFG->handlebounces is not set. Please review config-dist.php for more information.';
$string['dkimmanager'] = 'SPF & DKIM manager';
$string['dkimmanagerhelp'] = '<p>This shows all DKIM key pairs / selectors available for email signing, including those made by this admin tool or put in place by external tools such as open-dkim. For most systems this is the end to end setup:</p>
<ol>
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024111301;
$plugin->release = 2024111301;
$plugin->version = 2024111400;
$plugin->release = 2024111400;
$plugin->requires = 2024042200;
$plugin->component = 'tool_emailutils';
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit a909a4b

Please sign in to comment.