Files
HotLunches/email-bouncebacks.php
2026-10-19 15:22:52 -07:00

78 lines
2.7 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
// Start the template and output buffering
startTemplate();
$templatePageTitle = "$TitleText " . getLanguageText('TEXT-ADMINISTRATION');
$headerArgs = "";
// Ensure that only admin users have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Communications Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
$action = '';
$naction = '';
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
exit();
}
// sets the email contact table
$PrimaryTable = "contacts";
if (isset($_POST['CleanUp'])) {
$tables = "email_send_log AS l LEFT JOIN $PrimaryTable AS c ON c.email=l.email AND c.active='Y'";
$query = "UPDATE $tables SET c.active='N' WHERE l.status='Bounced'";
db_query($query);
$updateNum = db_affected_rows();
if ($updateNum < 1) $msg = "<b>There are currently no bounced back email addresses to deactivate.</b>";
elseif ($updateNum == 1) $msg = "<b>$updateNum email contact has been successfully deactivated.</b>";
else $msg = "<b>$updateNum email contacts have been successfully deactivated.</b>";
}
?>
<center>
<br>
<form method='post' action=''>
<table width='<?php echo($default_table_width) ?>' cellpadding='5' cellspacing='5' border='0' bgcolor='#eeeeee'>
<tr>
<td class='menu-item' align='center'><b>Bounce Back Administration</b></td>
</tr>
<tr>
<td align='center' class='menu-item'>
<?php if ($msg) { ?>
<p><font color="green"><?php echo $msg ?></font></p>
<?php } ?>
<p>&nbsp;</p>
<p><b>What are E-Mail Bounce Backs?</b></p>
<p>Bounced back e-mail is e-mail that is returned to you (the sender) because it cannot be delivered for some reason.<br>
These returned message usually appear in your INBOX as new emails after an e-mail blast has been sent.</p>
<p>&nbsp;</p>
<p><b>To deactivate these e-mail addresses from your<br>contact list, click on the below button.</b></p>
<p><input type='submit' class='btn btn--primary' name="CleanUp" value="Clean Up Bounced Back E-mails"></p>
<p>&nbsp;</p>
</td>
<!--
<input type='hidden' name='action' value='<?php echo($action) ?>'>
<input type='hidden' name='naction' value='<?php echo($next_naction) ?>'>
<input type='hidden' name='record_num' value='<?php echo($record_num) ?>'>
-->
<br>
<br>
</td>
</tr>
</table>
</form>
</center>
<?php
endTemplate();
?>