关于使用mail命令发送邮件报错:Address family not supported by protocol
Posted on 2021-11-02 17:46 520_1351 阅读(2247) 评论(0) 编辑 收藏 举报今天在一台linux主机下在使用mail命令发送邮件时,报如下错误:
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 protocol
根据报错信息,应该是与postfix服务器的配置文件中的inet_protocols有关系,于是找到其主配置文件 /etc/postfix/main.cf
发现inet_protocols的值被配置成了all (想起应该是系统升级后,将postfix也升级了,也覆盖了之前的配置),
# Enable IPv4, and IPv6 if supported inet_protocols = all
解决方法(根据自己的服务器所在环境而修改,如下relayhost为新增行):
[qq_5201351@localhost ~]$ grep -E "^inet_protocols|^relayhost" /etc/postfix/main.cf inet_protocols = ipv4 relayhost = 10.10.1.130:25
注:不能写成IPv4,最后让postfix重加载一下配置,发送邮件,测试,问题解决~、
最后,附其他有效配置,记录一下,内容如下:
[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.html
作者:一名卑微的IT民工
出处:https://www.cnblogs.com/5201351
本博客所有文章仅用于学习、研究和交流目的,欢迎非商业性质转载。
由于博主的水平不高,文章没有高度、深度和广度,只是凑字数,不足和错误之处在所难免,希望大家能够批评指出。
博主是利用读书、参考、引用、复制和粘贴等多种方式打造成自己的文章,请原谅博主成为一个卑微的IT民工!