Hello everyone.

I'm trying to set up a specific mail server configuration on 3 sites.
The first one is hosting a mailhub (with spam filter, etc.) and the 
2 others are agencies.
The 2 agencies use the same domain (eg. edatis.com) for mailing.
I'm currently working on the first agency's server.
Accounts are stored in MySQL db replicated on the 2 sites from the hub.

So, my problem is : if I don't care about "transport" statements, all mail is 
delivered on the local agency server, and if I do, mail is directly sent to 
the other agency, without passing by the mailhub.
I need all outgoing email (remote agency or internet) to pass by the hub.

I found very few inaccurate info about this setup (seems kind of unusual) so 
I'm asking for help. The objective is also supporting an undefined number of 
agency with this principle.

Here are my conf files :
#####################################
#### main.cf ####
smtpd_banner = $myhostname ESMTP
biff = no
append_dot_mydomain = no

mydomain = edatis.net
myhostname = hermes-test.$mydomain
myfullhostname = $myhostname
mynetworks = 127.0.0.0/8 192.168.0.0/22
myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain, , localhost
inet_interfaces = all

#virtual_alias_domains
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virt-users.cf 
proxy:mysql:/etc/postfix/mysql-virt-aliases.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virt-domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virt-boxes.cf
virtual_mailbox_base = /home/mail
virtual_uid_maps = static:103
virtual_gid_maps = static:107
relay_transport = smtp:mxhub.edatis.com
#relayhost = mxhub.edatis.com
transport_maps = proxy:mysql:/etc/postfix/mysql-virt-transports.cf

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mailbox_size_limit = 0
recipient_delimiter = +

#### mysql-virt-aliases.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT dest FROM aliases, domains WHERE aliases.local_part='%u' AND 
domains.name='%d' AND aliases.domain_id=domains.id

#### mysql-virt-boxes.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT(domains.name,'/',users.local_part,'/') FROM users, 
domains WHERE users.local_part='%u' AND domains.name='%d' AND 
users.domain_id=domains.id

#### mysql-virt-domains.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT name FROM domains WHERE name='%s'

#### mysql-virt-transports.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT('smtp:',agences.server) FROM agences,users,domains WHERE 
agences.id=users.server_id and domains.id=users.domain_id and 
domains.name='%d' and users.local_part='%u'

#### mysql-virt-users.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT(users.local_part, '@', domains.name) FROM users, domains 
WHERE users.local_part='%u' AND domains.name='%d' AND 
users.domain_id=domains.id
#####################################

Let me know if you need more details
Thanks by advance
Regards
-- 
***************************
Jonathan Amiez
Administrateur système
j...@edatis.com
it-pa...@edatis.com
ad...@edatis.com
***************************

Reply via email to