/ 中存储网

解决sendmail connection refused by [127.0.0.1]的问题

2014-11-01 01:40:20 来源:中存储网

1.mail 命令发邮件

echo "bbbbbbbb"|mail -s "aaaaa" hello@139.com

2.发送不成功,查看log

Dec  5 16:44:28 intranet sendmail[9891]: qB58iSe0009891: to= hello@139.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30039, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

此信息说明是被自己给拒绝了,主要原因是hostname和hosts文件配置不一样造成的,请保证配置正确:如下

cat  /etc/hosts

127.0.0.1             localhost.localdomain localhost

cat /etc/sysconfig/network

HOSTNAME=localhost.localdomain