Quarantine Report: ==== user@somedomain.com has empty e-mail recipient address, skipping...
Posted: 22 Sep 2016 19:43
If a user's "User Type" is Administrator or Domain Administrator, the quarantine report will not get delivered unless the Quarantine Report Recipient contains an overriding email address. The description says "Override quarantine report recipient (uses your username if blank)" but this only works if the user's "User Type" is "User".
Here is the relevant code in 3.0.1.1
/usr/local/bin/mailwatch/tools/Cron_jobs/quarantine_report.phpAs you can see, 'A'dministrators fall through to the default case statement which was never intended to happen.
Since 'A', 'U' and default all use the same code and only 'D' is different, there's really no point in even having 'A' and 'U' defined but I left them there so the code is clear. I used the code from 'U' as the default which uses the username as email address if the quarantine_rcpt email address is blank so it behaves as per the GUI description.
I (administrator) now get a quarantine report if my override email address is blank like the rest of our users.
Here is the relevant code in 3.0.1.1
/usr/local/bin/mailwatch/tools/Cron_jobs/quarantine_report.php
Code: Select all
switch ($user->type) {
case 'U':
// Type: user - see if to address needs to be overridden
if (!empty($user->quarantine_rcpt)) {
$email = $user->quarantine_rcpt;
} else {
$email = $user->username;
}
$to_address = $user->username;
$to_domain = $user->username;
break;
case 'D':
// Type: domain admin - this must be overridden
$email = $user->quarantine_rcpt;
$to_address = $user->username;
if (preg_match('/(\S+)@(\S+)/', $user->username, $split)) {
$to_domain = $split[2];
} else {
$to_domain = $user->username;
}
break;
default:
// Shouldn't ever get here - but just in case...
$email = $user->quarantine_rcpt;
$to_address = $user->username;
$to_domain = $user->username;
break;
}
Since 'A', 'U' and default all use the same code and only 'D' is different, there's really no point in even having 'A' and 'U' defined but I left them there so the code is clear. I used the code from 'U' as the default which uses the username as email address if the quarantine_rcpt email address is blank so it behaves as per the GUI description.
Code: Select all
switch ($user->type) {
case 'D':
// Type: domain admin - this must be overridden
if (!empty($user->quarantine_rcpt)) {
$email = $user->quarantine_rcpt;
} else {
$email = $user->username;
}
$to_address = $user->username;
if (preg_match('/(\S+)@(\S+)/', $user->username, $split)) {
$to_domain = $split[2];
} else {
$to_domain = $user->username;
}
break;
case 'A':
case 'U':
default:
// Type 'A'dministrator, 'U'ser and everything else just in case...
if (!empty($user->quarantine_rcpt)) {
$email = $user->quarantine_rcpt;
} else {
$email = $user->username;
}
$to_address = $user->username;
$to_domain = $user->username;
break;
}