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

Bouncemgt - allowing processing only existing bounces + a related new rule action #1028

Merged
merged 7 commits into from
Mar 28, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions public_html/lists/admin/bouncemgt.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
echo $spb.PageLink2('checkbouncerules', s('Check Current Bounce Rules')).$spe;

echo $spb.PageLink2('processbounces', s('Process Bounces')).$spe;
echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), '', false, s('Reprocess Only Existing Bounces')).$spe;

echo '</ul><br />';

Expand All @@ -24,3 +25,4 @@
echo '<p class="information text-warning"><big>'.s('You have already defined bounce rules in your system. Be careful with generating new ones, because these may interfere with the ones that exist.').'</big></p>';
}
echo '<br /><p class="button">'.PageLink2('generatebouncerules', s('Generate Bounce Rules')).'</p>';

1 change: 1 addition & 0 deletions public_html/lists/admin/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'unconfirmuseranddeletebounce' => $GLOBALS['I18N']->get('unconfirm subscriber and delete bounce'),
'blacklistuseranddeletebounce' => $GLOBALS['I18N']->get('blacklist subscriber and delete bounce'),
'blacklistemailanddeletebounce' => $GLOBALS['I18N']->get('blacklist email address and delete bounce'),
'decreasecountconfirmuseranddeletebounce' => $GLOBALS['I18N']->get('decrease count and confirm subscriber and delete bounce'),
'deletebounce' => $GLOBALS['I18N']->get('delete bounce'),
);

Expand Down
49 changes: 33 additions & 16 deletions public_html/lists/admin/processbounces.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,26 +505,27 @@ function processMessages($link, $max)
flushBrowser();

$download_report = '';
switch ($bounce_protocol) {
case 'pop':
$download_report = processPop($bounce_mailbox_host, $bounce_mailbox_user, $bounce_mailbox_password);
break;
case 'mbox':
$download_report = processMbox($bounce_mailbox);
break;
default:
Error($GLOBALS['I18N']->get('bounce_protocol not supported'));
if (!isset($_GET['justexisting'])) {
switch ($bounce_protocol) {
case 'pop':
$download_report = processPop($bounce_mailbox_host, $bounce_mailbox_user, $bounce_mailbox_password);
break;
case 'mbox':
$download_report = processMbox($bounce_mailbox);
break;
default:
Error($GLOBALS['I18N']->get('bounce_protocol not supported'));

return;
}
return;
}

if ($GLOBALS['commandline'] && $download_report === false) {
cl_output(s('Download failed, exiting'));
if ($GLOBALS['commandline'] && $download_report === false) {
cl_output(s('Download failed, exiting'));

return;
}
return;
}
// now we have filled database with all available bounces

}
//# reprocess the unidentified ones, as the bounce detection has improved, so it might catch more

cl_output('reprocessing');
Expand Down Expand Up @@ -648,6 +649,22 @@ function processMessages($link, $max)
}
deleteBounce($row['bounce']);
break;
case 'decreasecountconfirmuseranddeletebounce':
Sql_Query(sprintf('update %s set bouncecount = bouncecount -1 where id = %d',
$GLOBALS['tables']['user'], $row['user']));
if (!$confirmed) {
logEvent('User ' . $userdata['email'] . ' confirmed by bounce rule ' . PageLink2('bouncerule&amp;id=' . $rule['id'],
$rule['id']));
Sql_Query(sprintf('update %s set confirmed = 1 where id = %d', $GLOBALS['tables']['user'],
$row['user']));
$advanced_report .= 'User ' . $userdata['email'] . ' made confirmed by bounce rule ' . $rule['id'] . PHP_EOL;
$advanced_report .= 'User: ' . $report_linkroot . '/?page=user&amp;id=' . $userdata['id'] . PHP_EOL;
$advanced_report .= 'Rule: ' . $report_linkroot . '/?page=bouncerule&amp;id=' . $rule['id'] . PHP_EOL;
addUserHistory($userdata['email'], s('Auto confirmed'),
s('Subscriber auto confirmed for') . ' ' . $GLOBALS['I18N']->get('bounce rule') . ' ' . $rule['id']);
}
deleteBounce($row['bounce']);
break;
case 'blacklistuser':
if (!$blacklisted) {
logEvent('User ' . $userdata['email'] . ' blacklisted by bounce rule ' . PageLink2('bouncerule&amp;id=' . $rule['id'],
Expand Down
Loading