目前的情况。我们通过 G Suite/Business 将一些人从本地 Postfix 迁移到 Google GMail。
因为出于测试原因,目前只有 4 个人使用 GMail。而我们应该有 10 个人使用。
但他们必须配置好一切,所以我们必须继续使用这两项服务。
我认为 GMail 配置得很好。如果我从[电子邮件保护]到[电子邮件保护]它将邮件转发到 Gmail 服务器和我们的本地 Postfix。所以一切都很好。
但是如果 Postfix 向本地域发送消息,则该消息仅在本地 postfix/dovecot 实例中可用。没有中继到 GMail,因为它是本地的...
我如何将这些邮件从本地 postfix <-> 本地 postfix 中继到 gmail 服务器?
当前配置:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) is ready to be MARVELOUS
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file= /etc/ssl/mail.example.org.crt
smtpd_tls_key_file= /etc/ssl/mail.example.org.key
smtpd_tls_CAfile = /etc/ssl/mail.example.org.ca-bundle
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.example.org
mydomain = example.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
message_size_limit = 102400000
# G Suite
relayhost = [smtp-relay.gmail.com]:587
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_alias_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
如果我添加运输
* smtp:[smtp-relay.gmail.com]
我遇到了一个循环,邮件在 GMail 中,但不在 dovecot 中。
提前感谢您的想法!
答案1
不要添加通配符传输,这显然会转发全部邮件。相反,明确转发已迁移到 GMail 的个人用户。当a
用户[email protected]
已经迁移,但此域中的所有其他用户尚未迁移时,请使用如下传输文件:
[email protected] smtp:[smtp-relay.gmail.com]
[email protected] smtp:[smtp-relay.gmail.com]
[email protected] smtp:[smtp-relay.gmail.com]
[email protected] smtp:[smtp-relay.gmail.com]