[Web] Feature: Expand alias over alias domains
parent
d7f860dbbf
commit
a3c6c51b35
|
@ -1934,6 +1934,35 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($_data['expand_alias'] === true || $_data['expand_alias'] == 1) {
|
||||||
|
$stmt = $pdo->prepare("SELECT `goto`, GROUP_CONCAT(CONCAT(SUBSTRING(`alias`.`address`, 1, LOCATE('@', `alias`.`address`) - 1), '@', `alias_domain`.`alias_domain`)) AS `missing_alias`
|
||||||
|
FROM `alias` JOIN `alias_domain` ON `alias_domain`.`target_domain` = `alias`.`domain`
|
||||||
|
WHERE CONCAT(SUBSTRING(`alias`.`address`, 1, LOCATE('@', `alias`.`address`) - 1), '@', `alias_domain`.`alias_domain`) NOT IN (
|
||||||
|
SELECT `address` FROM `alias` WHERE `address` != `goto`
|
||||||
|
)
|
||||||
|
AND `alias`.`address` NOT IN (
|
||||||
|
SELECT `address` FROM `alias` WHERE `address` = `goto`
|
||||||
|
)
|
||||||
|
AND `address` = :address ;");
|
||||||
|
$stmt->execute(array(
|
||||||
|
':address' => $address
|
||||||
|
));
|
||||||
|
$missing_aliases = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if (!empty($missing_aliases['missing_alias'])) {
|
||||||
|
mailbox('add', 'alias', array(
|
||||||
|
'address' => $missing_aliases['missing_alias'],
|
||||||
|
'goto' => $missing_aliases['goto'],
|
||||||
|
'sogo_visible' => 1,
|
||||||
|
'active' => 1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'success',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||||
|
'msg' => array('alias_modified', htmlspecialchars($address))
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$domain = idn_to_ascii(substr(strstr($address, '@'), 1), 0, INTL_IDNA_VARIANT_UTS46);
|
$domain = idn_to_ascii(substr(strstr($address, '@'), 1), 0, INTL_IDNA_VARIANT_UTS46);
|
||||||
if ($is_now['address'] != $address) {
|
if ($is_now['address'] != $address) {
|
||||||
$local_part = strstr($address, '@', true);
|
$local_part = strstr($address, '@', true);
|
||||||
|
|
|
@ -650,6 +650,7 @@
|
||||||
"active": "Aktiv",
|
"active": "Aktiv",
|
||||||
"add": "Hinzufügen",
|
"add": "Hinzufügen",
|
||||||
"add_alias": "Alias hinzufügen",
|
"add_alias": "Alias hinzufügen",
|
||||||
|
"add_alias_expand": "Alias über Alias-Domains expandieren",
|
||||||
"add_bcc_entry": "BCC-Eintrag hinzufügen",
|
"add_bcc_entry": "BCC-Eintrag hinzufügen",
|
||||||
"add_domain": "Domain hinzufügen",
|
"add_domain": "Domain hinzufügen",
|
||||||
"add_domain_alias": "Domain-Alias hinzufügen",
|
"add_domain_alias": "Domain-Alias hinzufügen",
|
||||||
|
@ -661,7 +662,7 @@
|
||||||
"add_tls_policy_map": "TLS-Richtlinieneintrag hinzufügen",
|
"add_tls_policy_map": "TLS-Richtlinieneintrag hinzufügen",
|
||||||
"address_rewriting": "Adressumschreibung",
|
"address_rewriting": "Adressumschreibung",
|
||||||
"alias": "Alias",
|
"alias": "Alias",
|
||||||
"alias_domain_alias_hint": "Alias-Adressen werden <b>nicht</b> automatisch auch auf Domain-Alias Adressen angewendet. Eine Alias-Adresse <code>mein-alias@domain</code> bildet demnach <b>nicht</b> die Adresse <code>mein-alias@alias-domain</code> ab.<br>E-Mail-Weiterleitungen an externe Postfächer sollten über Sieve (SOGo Weiterleitung oder im Reiter \"Filter\") angelegt werden.",
|
"alias_domain_alias_hint": "Alias-Adressen werden <b>nicht</b> automatisch auch auf Domain-Alias Adressen angewendet. Eine Alias-Adresse <code>mein-alias@domain</code> bildet demnach <b>nicht</b> die Adresse <code>mein-alias@alias-domain</code> ab.<br>E-Mail-Weiterleitungen an externe Postfächer sollten über Sieve (SOGo Weiterleitung oder im Reiter \"Filter\") angelegt werden. Der Button \"Alias über Alias-Domains expandieren\" erstellt fehlende Alias-Adressen in Alias-Domains.",
|
||||||
"alias_domain_backupmx": "Alias-Domain für Relay-Domain inaktiv",
|
"alias_domain_backupmx": "Alias-Domain für Relay-Domain inaktiv",
|
||||||
"aliases": "Aliasse",
|
"aliases": "Aliasse",
|
||||||
"allow_from_smtp": "Nur folgende IPs für <b>SMTP</b> erlauben",
|
"allow_from_smtp": "Nur folgende IPs für <b>SMTP</b> erlauben",
|
||||||
|
|
|
@ -648,6 +648,7 @@
|
||||||
"active": "Active",
|
"active": "Active",
|
||||||
"add": "Add",
|
"add": "Add",
|
||||||
"add_alias": "Add alias",
|
"add_alias": "Add alias",
|
||||||
|
"add_alias_expand": "Expand alias over alias domains",
|
||||||
"add_bcc_entry": "Add BCC map",
|
"add_bcc_entry": "Add BCC map",
|
||||||
"add_domain": "Add domain",
|
"add_domain": "Add domain",
|
||||||
"add_domain_alias": "Add domain alias",
|
"add_domain_alias": "Add domain alias",
|
||||||
|
@ -659,7 +660,7 @@
|
||||||
"add_tls_policy_map": "Add TLS policy map",
|
"add_tls_policy_map": "Add TLS policy map",
|
||||||
"address_rewriting": "Address rewriting",
|
"address_rewriting": "Address rewriting",
|
||||||
"alias": "Alias",
|
"alias": "Alias",
|
||||||
"alias_domain_alias_hint": "Aliases are <b>not</b> applied on domain aliases automatically. An alias address <code>my-alias@domain</code> <b>does not</b> cover the address <code>my-alias@alias-domain</code> (where \"alias-domain\" is an imaginary alias domain for \"domain\").<br>Please use a sieve filter to redirect mail to an external mailbox (see tab \"Filters\" or use SOGo -> Forwarder).",
|
"alias_domain_alias_hint": "Aliases are <b>not</b> applied on domain aliases automatically. An alias address <code>my-alias@domain</code> <b>does not</b> cover the address <code>my-alias@alias-domain</code> (where \"alias-domain\" is an imaginary alias domain for \"domain\").<br>Please use a sieve filter to redirect mail to an external mailbox (see tab \"Filters\" or use SOGo -> Forwarder). Use \"Expand alias over alias domains\" to automatically add missing aliases.",
|
||||||
"alias_domain_backupmx": "Alias domain inactive for relay domain",
|
"alias_domain_backupmx": "Alias domain inactive for relay domain",
|
||||||
"aliases": "Aliases",
|
"aliases": "Aliases",
|
||||||
"allow_from_smtp": "Only allow these IPs to use <b>SMTP</b>",
|
"allow_from_smtp": "Only allow these IPs to use <b>SMTP</b>",
|
||||||
|
|
|
@ -328,7 +328,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body help-block">
|
<div class="panel-body help-block">
|
||||||
<?=$lang['mailbox']['alias_domain_alias_hint'];?>
|
<?=$lang['mailbox']['alias_domain_alias_hint'];?>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="mass-actions-mailbox" data-actions-header="true"></div> -->
|
<!-- <div class="mass-actions-mailbox" data-actions-header="true"></div> -->
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
@ -349,6 +349,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
||||||
<li><a data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"sogo_visible":"0"}' href="#"><?=$lang['mailbox']['sogo_visible_n'];?></a></li>
|
<li><a data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"sogo_visible":"0"}' href="#"><?=$lang['mailbox']['sogo_visible_n'];?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
<a class="btn btn-sm btn-default" data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"expand_alias":true}' ><span class="glyphicon glyphicon-resize-full"></span> <?=$lang['mailbox']['add_alias_expand'];?></a>
|
||||||
<a class="btn btn-sm btn-success" href="#" data-toggle="modal" data-target="#addAliasModal"><span class="glyphicon glyphicon-plus"></span> <?=$lang['mailbox']['add_alias'];?></a>
|
<a class="btn btn-sm btn-success" href="#" data-toggle="modal" data-target="#addAliasModal"><span class="glyphicon glyphicon-plus"></span> <?=$lang['mailbox']['add_alias'];?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue