Postfix / Dovecot支持多个域名

我有一台运行Postfix / Dovecot的服务器,后端configuration为使用域名“olddomain.com”。 我正在迁移一切使用另一个域'newdomain.com'和Postfix / Dovecot / Postfixadmin都需要迁移。 不过,我需要支持这两个域名一段时间,这应该是透明的用户。 发送到“[email protected]”的电子邮件需要到达“[email protected]”,用户需要能够使用“[email protected]”和“username @ newdomain”login(Postfixadmin / Dovecot) .com“等。

我不知道如何做到这一点,以支持命名的用例,所以任何帮助,将不胜感激。

相关configuration的东西:

postconf -n

 command_directory = / usr / sbin
 config_directory = / etc / postfix
 daemon_directory = / usr / libexec / postfix
 data_directory = / var / lib / postfix
 debug_peer_level = 2
 debugger_command = PATH = / bin:/ usr / bin:/ usr / local / bin:/ usr / X11R6 / bin ddd $ daemon_directory / $ process_name $ process_id&sleep 5
 dovecot_destination_recipient_limit = 1
 html_directory = no
 mail_owner =后缀
 mail_spool_directory = / var / spool / mail
 mailq_path = / usr / bin / mailq
 manpage_directory = / usr / share / man
 mynetworks_style = host
 newaliases_path = / usr / bin / newaliases
 queue_directory = / var / spool / postfix
 readme_directory = no
 relay_domains = mysql:/etc/postfix/mysql_relay_domain_maps.cf
 relayhost = *******
 sample_directory = / etc / postfix
 sendmail_path = / usr / sbin / sendmail
 setgid_group = postdrop
 smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
 smtpd_sasl_auth_enable =是
 smtpd_sasl_path = private / auth
 smtpd_sasl_type = dovecot
 unknown_local_recipient_reject_code = 550
 virtual_alias_maps = mysql:/etc/postfix/sql_virtual_alias_maps.cf
 virtual_mailbox_domains = mysql:/etc/postfix/sql_virtual_domain_maps.cf
 virtual_mailbox_maps = mysql:/etc/postfix/sql_virtual_mailbox_maps.cf
 virtual_transport = dovecot

sql_virtual_mailbox_maps.cf:

密码= ****
 hosts = localhost
 dbname = pf_adm
 query = SELECT CONCAT(maildir,'Maildir /')AS maildir FROM mailbox WHERE username ='%s'AND active ='1'

sql_virtual_domain_maps.cf:

用户= ****
密码= ****
 hosts = localhost
 dbname = pf_adm
查询=select域从域WHERE域='%s'AND backupmx ='0'和活动='1'

sql_virtual_alias_maps.cf:

用户= ****
密码= ****
 hosts = localhost
 dbname = pf_adm
 query = SELECT goto FROM别名WHERE address ='%s'AND active ='1'

doveconf -n

 #2.1.9:/etc/dovecot/dovecot.conf
 #操作系统:Linux 3.4.5强化的i686 Gentoo基本系统版本2.1 ext4
 auth_verbose =是
 first_valid_gid = 12
 first_valid_uid = 8
 last_valid_gid = 12
 last_valid_uid = 8
 mail_gid = 12
 mail_location = maildir:/ var / mail /%d /%n / Maildir /:INDEX = / var / mail /%d /%n / indexes
 mail_uid = 8
命名空间收件箱{
  收件箱=是
  位置= 
  邮箱草稿{
     special_use = \草稿
   }
  邮箱垃圾{
     special_use = \ Junk
   }
  邮箱已发送{
     special_use = \发送
   }
  邮箱“发送邮件”{
     special_use = \发送
   }
  邮箱垃圾箱{
     special_use = \垃圾桶
   }
  前缀= 
 }
 passdb {
   args = /etc/dovecot/dovecot-sql.conf.ext
   driver = sql
 }
 postmaster_address = [email protected]
 protocols = imap
服务auth {
   unix_listener / var / spool / postfix / private / auth {
     group = postfix
    模式= 0660
    用户=后缀
   }
   unix_listener auth-userdb {
     group = mail
    模式= 0600
    用户=邮件
   }
 }
 ssl_cert = 

奖金信息(如果需要),用户存储如下:

+ ------------------------ + ------------------------ - + ------------ + --------------- + | 用户名| maildir | local_part | 域| + ------------------------ + ------------------------ - + ------------ + --------------- + | [email protected] | olddomain.com/username/ | 用户名| olddomain.com | + ------------------------ + ------------------------ - + ------------ + --------------- +

坚持要求每个地址的完整域名在这里背后咬你。

这实际上并不是必须的,因为你所拥有的只是一个域,所以一个简单的解决scheme就是将SQL查找改变为只对本地部分起作用。

将新域添加到virtual_mailbox_domains,并仅在virtual_mailbox_maps上执行本地部分查找。

这两个域和所有用户将被接受和交付。

对virtual_mailbox_domains使用复杂的查询也不可能有帮助。
只需在virtual_mailbox-domains中列出域名即可:

 virtual_mailbox_domains = olddomain, newdomain