Amavis的postfix在mail.log中返回“name = localhost type = A:Host not found”

完整的错误:

Dec 23 19:44:31 example.com postfix/pickup[5589]: 39332276875: uid=0 from=<fredflinstone> Dec 23 19:44:31 example.com postfix/cleanup[5605]: 39332276875: message-id=<[email protected]> Dec 23 19:44:31 example.com postfix/qmgr[5590]: 39332276875: from=<[email protected]>, size=300, nrcpt=1 (queue active) Dec 23 19:44:31 example.com postfix/smtp[5607]: 39332276875: to=<[email protected]>, relay=none, delay=0.05, delays=0.03/0.01/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=localhost type=A: Host not found) Dec 23 19:44:31 example.com postfix/cleanup[5605]: 453F3276876: message-id=<[email protected]> Dec 23 19:44:31 example.com postfix/bounce[5608]: 39332276875: sender non-delivery notification: 453F3276876 Dec 23 19:44:31 example.com postfix/qmgr[5590]: 453F3276876: from=<>, size=2273, nrcpt=1 (queue active) Dec 23 19:44:31 example.com postfix/qmgr[5590]: 39332276875: removed Dec 23 19:44:31 example.com postfix/local[5609]: 453F3276876: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to maildir) Dec 23 19:44:31 example.com postfix/qmgr[5590]: 453F3276876: removed 

本地主机在/ etc / hosts中。 可以ping它。 可以是nsswitch.conf或host.conf吗? 邮件提供罚款,当我禁用后缀amavis。 这是我的后缀configuration:

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no compatibility_level = 2 content_filter = smtp-amavis:[localhost]:10024 home_mailbox = Maildir/ inet_interfaces = all inet_protocols = ipv4 mailbox_size_limit = 0 mydestination = $myhostname, example.com, localhost myhostname = example.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname policy-spf_time_limit = 3600s readme_directory = no recipient_delimiter = + relayhost = smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_recipient_restrictions = , check_policy_service unix:private/policy-spf, check_policy_service unix:private/policy-spf smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_tls_auth_only = no smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = no tls_random_source = dev:/dev/urandom 

/etc/nsswitch.conf中

 hosts: files resolv [!UNAVAIL=return] mdns4_minimal [NOTFOUND=return] dns myhostname 

是/etc/host.conf

 order hosts,bind multi on 

/ etc / hosts文件

 127.0.0.1 localhost 10.0.7.4 localhost example.com localhost.example.com ::1 localhost ip6-localhost ip6-loopback 

/etc/postfix/master.conf

 smtp inet n - y - - smtpd pickup unix n - y 60 1 pickup cleanup unix n - y - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - y 1000? 1 tlsmgr rewrite unix - - y - - trivial-rewrite bounce unix - - y - 0 bounce defer unix - - y - 0 bounce trace unix - - y - 0 bounce verify unix - - y - 1 verify flush unix n - y 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - y - - smtp relay unix - - y - - smtp showq unix n - y - - showq error unix - - y - - error retry unix - - y - - error discard unix - - y - - discard local unix - nn - - local virtual unix - nn - - virtual lmtp unix - - y - - lmtp anvil unix - - y - 1 anvil scache unix - - y - 1 scache maildrop unix - nn - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} uucp unix - nn - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - nn - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - nn - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - nn - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - nn - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} policy-spf unix - nn - 0 spawn user=nobody argv=/usr/bin/policyd-spf smtp-amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o smtp_tls_note_starttls_offer=no 127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o smtpd_restriction_classes= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters -o local_header_rewrite_clients= -o smtpd_milters= -o local_recipient_maps= -o relay_recipient_maps= 

注意内容filter。 如果我对此发表评论,邮件交付就好了。 所以问题是与amavis? 新服务器上的新安装。 Ubuntu 16.10

你在/etc/hosts有错误。

你已经定义了10.0.7.4 localhost ,这是一个打破本地主机的好方法。 这不应该存在,应该立即删除。

将main.cf中的amavisd内容filter行从localhost更改为127.0.0.1解决了此问题。