Use tag settings for alias addresses
parent
9e2d9a5bcd
commit
4c8288f85e
|
@ -12,16 +12,23 @@ $opt = [
|
|||
try {
|
||||
$pdo = new PDO($dsn, $database_user, $database_pass, $opt);
|
||||
$stmt = $pdo->query("SELECT `username` FROM `mailbox` WHERE `wants_tagged_subject` = '1'");
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
while ($row = array_shift($rows)) {
|
||||
$rows_a = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
while ($row_a = array_shift($rows_a)) {
|
||||
$stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` REGEXP :username AND goto != `address` AND `address` NOT LIKE '@%'");
|
||||
$stmt->execute(array(':username' => '(^|,)'.$row_a['username'].'($|,)'));
|
||||
$rows_a_a = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
while ($row_a_a = array_shift($rows_a_a)) {
|
||||
echo strtolower(trim($row_a_a['address'])) . PHP_EOL;
|
||||
}
|
||||
$has_object = 1;
|
||||
echo strtolower(trim($row['username'])) . PHP_EOL;
|
||||
echo strtolower(trim($row_a['username'])) . PHP_EOL;
|
||||
}
|
||||
$stmt = $pdo->query("SELECT CONCAT(mailbox.local_part, '@', alias_domain.alias_domain) as `tag_ad` FROM `mailbox` INNER JOIN `alias_domain` ON mailbox.domain = alias_domain.target_domain WHERE mailbox.wants_tagged_subject='1';");
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
while ($row = array_shift($rows)) {
|
||||
$stmt = $pdo->query("SELECT CONCAT(`mailbox`.`local_part`, '@', `alias_domain`.`alias_domain`) AS `tag_ad` FROM `mailbox`
|
||||
INNER JOIN `alias_domain` ON `mailbox`.`domain` = `alias_domain`.`target_domain` WHERE `mailbox`.`wants_tagged_subject` = '1';");
|
||||
$rows_b = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
while ($row_b = array_shift($rows_b)) {
|
||||
$has_object = 1;
|
||||
echo strtolower(trim($row['tag_ad'])) . PHP_EOL;
|
||||
echo strtolower(trim($row_b['tag_ad'])) . PHP_EOL;
|
||||
}
|
||||
if ($has_object == 0) {
|
||||
echo "dummy@domain.local";
|
||||
|
|
Loading…
Reference in New Issue