postfix 虚拟设置 - 仅重定向一个域

postfix 虚拟设置 - 仅重定向一个域

好吧 - 我放弃寻找答案了,所以我在这里:)

我使用虚拟账户设置了 postfix/dovecot。我基本上遵循了本指南 http://pietervogelaar.nl/ubuntu-12-04-install-postfix-dovecot-and-vimbadmin/

但我理想中的想法是设置一个邮件服务器作为某些域的端点,同时中继其他域。

例子

example.com 是在邮件服务器本地托管的虚拟域。 [电子邮件保护]是本地服务器上的电子邮件地址,因此邮件存储在 /var/vmail/example.com/info 中

otherdomain.com 是一个域,需要将所有消息转发到 some.other-server.com,同时首先经过垃圾邮件/av 检查。没有邮件或帐户存储在本地。

编辑

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
dovecot_destination_recipient_limit = 1
enable_original_recipient = no
header_checks = regexp:/etc/postfix/header_checks
inet_interfaces = all
mailbox_size_limit = 0
mydestination = mx1.itmanx.com, localhost, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, reject_unauth_pipelining, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_rbl_client sbl.spamhaus.org, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql/virtual-aliases.cf
virtual_gid_maps = static:5000
virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual-mailboxes.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000

答案1

# Which domains will this server relay
relay_domains = $mydestination, mysql:/etc/postfix/mysql/relay_domains

# Which domains/accounts will this server store
virtual_alias_domains = mysql:/etc/postfix/mysql/virtual_alias_domains
virtual_alias_maps = mysql:/etc/postfix/mysql/virtual_alias_maps
virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_mailbox_domains
virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps
virtual_mailbox_base = /var/mail/virtual
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000

# Which transport to use for each domain
transport_maps = mysql:/etc/postfix/mysql/transport_maps


/etc/postfix/mysql/relay_domains
~ 此邮件服务器将中继的域(即发送到其他地方)

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT domain FROM domains WHERE domain = '%s' and relay = 1 and enabled = 1

在 /etc/postfix/mysql/virtual_alias_domains 中配置
~ 如果要将一个域转发到另一个域,请在 alias_domains 表中添加转发域,并在 alias_maps 表中添加路由,如@alias.com @goto.com。

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT domain FROM alias_domains WHERE domain = '%s' AND enabled = 1

/etc/postfix/mysql/virtual_alias_maps
~ 用户别名例如[电子邮件保护][电子邮件保护]
~ Catchall:@example.com 转到[电子邮件保护]
~ 注意:如果您使用的域不在域表中,则必须将其添加到 alias_domains 表中。

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT goto FROM alias_maps WHERE alias = '%s' AND enabled = 1

在/etc/postfix/mysql/virtual_mailbox_domains中
~ 此邮件服务器将处理的虚拟域

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT domain FROM domains WHERE domain = '%s' AND relay != 1 AND enabled = 1

在/etc/postfix/mysql/virtual_mailbox_maps中
~ 虚拟邮箱邮件的存储位置,以 virtual_mailbox_base 为前缀

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT maildir FROM mailboxes WHERE address = '%s' AND enabled = 1

/etc/postfix/mysql/transport_maps
~ 使用什么传输方式发送邮件,例如虚拟或中继
~ 您可以在传输字段中输入类似中继:[relay.mail-server.com] 的内容

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mydatabase
query = SELECT transport FROM domains WHERE domain = '%s'

答案2

我在你的配置中没有看到任何传输图。它应该是类似以下内容的

transport_maps = mysql:/etc/postfix/sql/relay_transport.conf
relay_domains = mysql:/etc/postfix/sql/transport.conf

/etc/postfix/sql/relay_domain.conf

user = postfixadmin
password = password
hosts = localhost
dbname = postfixadmin
query = SELECT domain FROM domain WHERE domain='%s' and transport = 'relay' and active = 1

/etc/postfix/sql/transport.conf

user = postfixadmin
password = password
hosts = localhost
dbname = postfixadmin
query = SELECT transport FROM domain WHERE domain='%s' and active = 1

注意:在描述字段中,您必须指定中继服务器的 IP 地址

您可以在以下位置获取更多信息http://sourceforge.net/apps/mediawiki/postfixadmin/index.php?title=Relay_Domains

相关内容