使用 postfix 中继/转发到 gmail

使用 postfix 中继/转发到 gmail

我在 Debian 6 上设置了 postfix,我想将电子邮件转发到我的 gmail 帐户。这是我的 /etc/postfix/main.cf 文件:

# 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 (Debian/GNU)
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.

myhostname = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = example.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

# configure for virtual hosting
virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual
home_mailbox = mail/

在我的 /etc/postfix/virtual 文件中我有:

 [email protected] [email protected]

但是当我从 hotmail 发送电子邮件到[电子邮件保护]我收到以下错误:

Final-Recipient: rfc822;[email protected]
Action: failed
Status: 5.7.1
Diagnostic-Code: smtp;554 5.7.1 <[email protected]: Relay access denied

/var/log/mail.log 显示:

postfix/smtpd[31752]: connect from mail-qy0-f178.google.com[xxx.xx.xxx.xxx]
postfix/smtpd[31752]: NOQUEUE: reject: RCPT from mail-qy0-f178.google.com[xxx.xx.xxx.xxx]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-qy0-f178.google.com>
postfix/smtpd[31752]: disconnect from mail-qy0-f178.google.com[xxx.xx.xxx.xxx]

我是否需要对 SMTP 身份验证做些什么?

已修复。在 /etc/postfix/main.cf 文件中,我有:

mydestination = www.example.com, localhost

用以下内容替换即可使其工作:

mydestination = example.com, localhost

答案1

example.commydestination。你为什么不添加到/etc/aliases

test    [email protected]

newaliases更新别名文件后不要忘记运行。

答案2

我没有在您的 /etc/postfix/main.cf 文件中看到“virtual_alias_domains”参数。请尝试将其添加到:

虚拟别名域名 = example.com

另外,请确保运行以下命令:

后映射 /etc/postfix/virtual

服务 Postfix 重新加载

相关内容