Tai*_*red 38 email email-server postfix
当我尝试在我的 postfix 服务器上向同一域中的地址发送电子邮件时(例如,如果服务器主机名是 mail.example.com 并且我尝试向 test@example.com 发送电子邮件),我得到日志中出现以下错误并且电子邮件未送达:Recipient address rejected: User unknown in local recipient table
。如果我发送到另一个域上的地址,我没有任何问题。这是我的 /etc/postfix/main.cf 文件:
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.
myhostname = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#myorigin = /etc/mailname
myorigin = $mydomain
mydestination = $mydomain, localhost.$mydomain, localhost
relayhost =
#fake IP address
mynetworks = 127.0.0.0/8 100.837.191.223
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
Run Code Online (Sandbox Code Playgroud)
chm*_*mac 54
我知道这个问题有点老了,所以我假设它已经得到了令人满意的回答。
我刚刚遇到了同样的问题,我花了一段时间才弄清楚发生了什么。我认为我的情况与原始问题相同。
Postfix 应该将所有邮件中继到 Internet 上的其他服务器,它实际上不会接收任何域的邮件。因此,任何发送到 example.com 的邮件都应该转发到 example.com 的邮件服务器。正如 b techieb0y 所解释的,解决方案是从行中删除 $mydomain:
mydestination = $mydomain, localhost.$mydomain, localhost
Run Code Online (Sandbox Code Playgroud)
这一行告诉 postfix 任何发送到 $mydomain 的消息都将被接收并存储在这个服务器上。这不是我想要的,我希望将这些消息发送到 example.com 的实际邮件服务器。一旦我意识到这一点,并删除了example.com,邮件就会按我的预期工作。我发布此信息的可能性很小,因为此解释可以帮助将来偶然发现此问题的其他人。
tec*_*b0y 23
该错误是不言自明的:目标电子邮件用户名(@ 符号的左侧)不能映射到系统上的本地用户(默认后缀设置),也不能映射到虚拟域(因为没有配置出盒子)。尝试执行此映射的决定由“mydestination”中的域列表(加上任何虚拟域)控制。如果这台机器实际上是域的主 MX,那么不存在的用户的邮件已损坏。如果此框只需要发送外发消息,只需从 mydestination 中删除目标域(通过从列表中删除 $mydomain)就足够了——它仍然会直接接受 user@hostname.domain.tld 的消息,但接受 user@ 的消息domain.tld 将通过 MX 查找过程以交付其他地方。
当您向本地域发送消息时,postfix 负责检查收件人是否存在。当您向任何其他域发送电子邮件时,postfix 没有此类责任。
您要么需要有一个名为 test 的本地用户
useradd -s /bin/bash -d /home/test -U test
Run Code Online (Sandbox Code Playgroud)
或者,您需要一个别名从 test 到 /etc/aliases 中的本地用户
echo "test: root" >> /etc/aliases
postalias /etc/aliases
Run Code Online (Sandbox Code Playgroud)
你应该一切都准备好了。
归档时间: |
|
查看次数: |
139257 次 |
最近记录: |