Add block/white list option for email senders

This commit is contained in:
danwin1210 committed 2026-10-13 11:17:14 +02:00
1 parent ccb58b35f4
commit 09832ceef7
7 files changed
+164 -18

No files matched your search

+18 -1
View File
@@ -9,7 +9,7 @@ const DBHOST = 'localhost'; // Database host
const DBUSER = 'postfix'; // Database user
const DBPASS = 'YOUR_PASSWORD'; // Database password
const DBNAME = 'postfix'; // Database
const DBVERSION = 6; // Database schema version
const DBVERSION = 7; // Database schema version
const INACTIVITY_PERIOD_MONTHS = [1, 6, 12, 24]; // Allowed inactivity periods in months - don't forget to update get_inactivity_period_options on changes here and if an option is removed, you should also update accounts in the database mailbox table
const DEFAULT_INACTIVITY_PERIOD = 12; // Default inactivity period in months
const ALLOW_ACCOUNT_NEVER_DELETE = false; // Whether to allow users to set their inactivity period to "never delete"
@@ -458,6 +458,23 @@ function check_email_valid( string $email, string &$msg = '' ): bool
return true;
}
function parse_sender_address_list( string $value ): ?array
{
$validator = new EmailValidator();
$addresses = [];
foreach ( preg_split( '/\R/', $value ) as $address ) {
$address = trim( $address );
if ( $address === '' ) {
continue;
}
if ( ! $validator->isValid( $address, new NoRFCWarningsValidation() ) ) {
return null;
}
$addresses[] = mb_strtolower( $address );
}
return array_values( array_unique( $addresses ) );
}
function alt_links(): void
{
global $language;