Alternc  latest
Alternc logiel libre pour l'hébergement
3.1.1~a.sql
Go to the documentation of this file.
1 CREATE OR REPLACE VIEW `alias_view` AS
2 
3 -- Generate all the alias configured by the users
4 select
5  concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`,
6  concat(if(isnull(`mailbox`.`id`),
7  '',
8  concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),
9  `recipient`.`recipients`) AS `alias`
10 from
11  (
12  ((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`)))
13  left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`))
14  )
15  join `domaines` on((`domaines`.`id` = `address`.`domain_id`))
16  )
17 where
18  `address`.`enabled` = 1
19 
20 UNION
21 
22 -- Generate the alias for all the account
23 -- Example : account gaylord will have gaylord@FQDN
24 -- as an alias to his email account. FQDN can be
25 -- changed in variable mailname_bounce
26 select
27  distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`,
28  `m`.`mail` AS `alias`
29 from
30  `membres` `m`,
31  `variable` `v`
32 where
33  `v`.`name` = 'mailname_bounce'
34 
35 UNION
36 
37 -- Generate an alias alterncpanel@FQDN to admin mail
38 select
39  distinct concat('alterncpanel','@',`v`.`value`) AS `mail`,
40  `m`.`mail` AS `alias`
41 from
42  `membres` `m`,
43  `variable` `v`
44 where
45  (`v`.`name` = 'mailname_bounce' AND `m`.`uid`=2000)
46 
47 ;
48 
49 
50 -- We didn't migrate existing catchall address properly (sniff)
51 UPDATE address SET TYPE="catchall" WHERE address="";
52 
53 UPDATE domaines_type SET only_dns=1 WHERE name='ip';
54 UPDATE domaines_type SET only_dns=0 WHERE name='url';
55 UPDATE domaines_type SET only_dns=0 WHERE name='panel';
56