配置Postfix以将邮件转发到其他邮件地址(ex gmail)?

时间:2015-03-20 10:49:45

标签: postfix-mta

我已在我的Ubuntu服务器上配置Postfix来发送/接收邮件。

虽然发送工作完全正常,但接收不是。我想将收到的所有邮件转发到我的Gmail帐户。

我的/etc/postfix/mail.cf如下:

# 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)
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/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.compzzz.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_domains = compzzz.com
virtual_alias_maps = hash:/etc/postfix/virtual
myorigin = /etc/mailname
mydestination = droplet1.compzzz.com, localhost.compzzz.com, localhost, compzzz.com, mail.compzzz.com
relayhost =
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

我的/etc/postfix/virtual是:

@compzzz.com ramabc@gmail.com

我发送给abc@compzzz.com的任何邮件,我收到一封未知用户错误的投递失败的电子邮件。

我在某个地方出错了吗?

1 个答案:

答案 0 :(得分:2)

不幸从技术人员那里获得任何帮助迫使我自己通过postfix documentation

只需评论声明mydestination的行就可以了。

即替换

mydestination = droplet1.compzzz.com, localhost.compzzz.com, localhost, compzzz.com, mail.compzzz.com

#mydestination = droplet1.compzzz.com, localhost.compzzz.com, localhost, compzzz.com, mail.compzzz.com

要将电子邮件转发到其他地址(服务器除外),mydestination参数不是必需的,只需virtual_alias_domainsvirtual_alias_maps