关于使用mail命令发送邮件报错:Address family not supported by protocol

2022年01月14日 阅读数:2
这篇文章主要向大家介绍关于使用mail命令发送邮件报错:Address family not supported by protocol,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。

今天在一台linux主机下在使用mail命令发送邮件时,报以下错误:html

send-mail: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol
postdrop: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocollinux

 

根据报错信息,应该是与postfix服务器的配置文件中的inet_protocols有关系,因而找到其主配置文件 /etc/postfix/main.cf 服务器

发现inet_protocols的值被配置成了all (想起应该是系统升级后,将postfix也升级了,也覆盖了以前的配置),dom

# Enable IPv4, and IPv6 if supported
inet_protocols = all

解决方法(根据本身的服务器所在环境而修改,以下relayhost为新增行):post

[qq_5201351@localhost ~]$ grep -E "^inet_protocols|^relayhost" /etc/postfix/main.cf
inet_protocols = ipv4
relayhost = 10.10.1.130:25

注:不能写成IPv4,最后让postfix重加载一下配置,发送邮件,测试,问题解决~、测试

 

最后,附其余有效配置,记录一下,内容以下:spa

[qq_5201351@localhost ~]$ cat /etc/postfix/main.cf |grep ^# -v |grep ^$ -v
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
relayhost = 10.10.1.130:25
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases


debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/15500154.htmldebug