Postfix RCPT TO临时查找失败

我对服务器毫无头绪,因此必须设置postfix才会给我带来困难。 我知道这个错误很常见,但是即使花费了半天时间并尝试了各种解决scheme,也没有任何解决方法。 有人会有足够的能力把我抓住一点吗?

我从digitialocean(128.199.248.101)买了一个域名(plainsight.in)和一个服务器,并试图设置它们来发送电子邮件。 最后的目标是build立TLS和整个shebang并发送邮件到gmail.com,但是现在连localhost到localhost的邮件都不能正常工作:

telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 dev.plainsight.in ESMTP Postfix (Ubuntu) helo localhost 250 dev.plainsight.in mail from: root@localhost 250 2.1.0 Ok rcpt to: root@localhost 451 4.3.0 <root@localhost>: Temporary lookup failure 

这让我感到困惑。 为什么localhost到localhost导致查找失败?

至less所有的邮件设置都是正确的,就像在这个mxtoolbox 页面上看到的那样。 此外,这是我的main.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 = dev.plainsight.in #alias_maps = hash:/etc/aliases virtual_alias_maps = hash:/etc/postfix/virtual alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = plainsight.in, personal-projects, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128, 128.199.248.101 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all 

邮件日志的最后几行是:

 Dec 28 13:39:49 personal-projects postfix/trivial-rewrite[28844]: warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory Dec 28 13:39:49 personal-projects postfix/trivial-rewrite[28844]: warning: hash:/etc/postfix/virtual: table lookup problem Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: warning: hash:/etc/postfix/virtual lookup error for "root@localhost" Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <root@localhost>: Temporary lookup failure; from=<root@localhost> to=<root@localhost> proto=SMTP helo=<localhost> Dec 28 13:39:56 personal-projects postfix/smtpd[28903]: disconnect from localhost[127.0.0.1] 

请帮忙吗? 🙂

看起来你忘了运行postmap /etc/postfix/virtual 。 请记住每次更改该文件时都要这样做。