關於使用mail命令發送郵件報錯:Address family not supported by protocol


今天在一台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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM