Ajout d'une vue SQL alias_view pour gérer les alias de mail plus simplement
This commit is contained in:
parent
ebf9c3c5c8
commit
b7314e97e8
|
@ -6,6 +6,6 @@ user = %%db_mail_user%%
|
|||
password = %%db_mail_pwd%%
|
||||
hosts =%%dbhost%%
|
||||
dbname = %%dbname%%
|
||||
query = select concat( if(isnull(mailbox.id), '', concat(concat(address.address,'@',domaines.domaine), '\n')), recipient.recipients ) from recipient join address on address.id = recipient.address_id left outer join mailbox on mailbox.address_id = address.id join domaines on domaines.id = address.domain_id where concat(address.address,'@',domaines.domaine)='%s';
|
||||
query = select alias from alias_view where mail='%s';
|
||||
|
||||
|
||||
|
|
|
@ -330,6 +330,12 @@ if [ -x /usr/sbin/locale-gen ] ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
#######################################################################
|
||||
#populate alternc database with the mailname used by postfix to send mail for each vhost
|
||||
#
|
||||
mailname=`cat /etc/mailname`
|
||||
mysql_query "update table variable SET value="$mailname" where name='mailname_bounce';"
|
||||
|
||||
#######################################################################
|
||||
# Save installed files to check them during next install
|
||||
#
|
||||
|
|
|
@ -646,7 +646,7 @@ CREATE TABLE IF NOT EXISTS `cron` (
|
|||
|
||||
|
||||
--
|
||||
-- Structure de la vue `dovecot-view`
|
||||
-- Structure de la vue `dovecot_view`
|
||||
--
|
||||
|
||||
CREATE OR REPLACE VIEW `dovecot_view` AS
|
||||
|
@ -662,3 +662,18 @@ from ((`mailbox`
|
|||
join `address` on((`address`.`id` = `mailbox`.`address_id`)))
|
||||
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)));
|
||||
|
||||
--
|
||||
-- Structure de la vue `alias_view`
|
||||
--
|
||||
|
||||
CREATE OR REPLACE VIEW `alias_view` AS
|
||||
select concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`,
|
||||
concat(if(isnull(`mailbox`.`id`),'',concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),`recipient`.`recipients`) AS `alias`
|
||||
from (((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`)))
|
||||
left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`)))
|
||||
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)))
|
||||
union
|
||||
select distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`,
|
||||
`m`.`mail` AS `alias`
|
||||
from ((`membres` `m` join `variable` `v`) join `domaines` `d`)
|
||||
where (`v`.`name` = 'mailname_bounce');
|
||||
|
|
Loading…
Reference in New Issue