我跟着这在 Ubuntu 18.04 上设置 Postfix 的教程。请假设服务器的 IP 地址为 my.ip.add.ress(我在本帖中隐藏了我的 IP 地址和电子邮件地址)。此时,如果我将电子邮件地址发送到[电子邮件保护],我在 ~/Maildir 目录中收到了电子邮件 - 成功了!接下来,我决定设置一个万能地址,但当我向任何不是万能地址的地方发送电子邮件时[电子邮件保护], 例如[电子邮件保护],邮件日志内容如下:
Aug 2 21:50:08 v1 postfix/smtpd[17183]: NOQUEUE: reject: RCPT from mail-lj1-f170.google.com[209.85.208.170]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-lj1-f170.google.com>
亮点是The Recipient address rejected: User unknown in local recipient table
。
作为参考,这是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 (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
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# 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 = v1
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
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
home_mailbox = Maildir/
mydestination = localhost
virtual_alias_domains = my.ip.add.ress
virtual_alias_maps = hash:/etc/postfix/virtual
resolve_numeric_domain = yes
该/etc/postfix/virtual
文件内容很简单:
@my.ip.add.ress nicholas
这里的目标是,我通过 my.ip.add.ress 收到的任何电子邮件都会发送到我本地用户的邮箱。我觉得我已经搜索了很多解决方案,其中最值得注意的是官方文档,所以任何帮助都会很感激。我做了很多实验main.cf
——以上只是我最近的更新——但结果是一样的。在我做任何改变之后,我都会使用重新加载所有内容sudo postmap /etc/postfix/virtual && sudo postfix reload
,所以我认为这也不是什么问题。
编辑:当我在内部发送电子邮件时(),邮件会发送到我的本地邮箱。但是,如果我通过 Gmail 发送电子邮件,则电子邮件会被拒绝。echo 'init' | s-nail -s 'init' -Snorecord [email protected]