Linux系统下sendmail发送邮件失败的问题

     问题是:安装完sendmail,启动服务后,发送邮件第一次发送成功,后面再次无论怎么发送都不行,换邮箱也不行。在确认我的邮件发送格式正确无误后,想到查看邮件发送日志:

[root@backup-11 ~]# tail -20 /var/log/maillog
Oct  6 23:26:40 backup-11 sendmail[1307]: t96FQeu7001305: to=<aqiang831214@163.com>, ctladdr=<zkq@backup-11> (500/500), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120620, relay=163mx03.mxmail.netease.com. [220.181.14.158], dsn=5.0.0, stat=Service unavailable
Oct  6 23:26:40 backup-11 sendmail[1307]: t96FQeu7001305: t96FQeu7001307: DSN: Service unavailable
Oct  6 23:26:40 backup-11 sendmail[1307]: t96FQeu7001307: to=<zkq@backup-11>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31818, dsn=2.0.0, stat=Sent
Oct  6 23:26:41 backup-11 sendmail[1291]: unable to qualify my own domain name (backup-11) -- using short name
Oct  6 23:26:41 backup-11 sendmail[1311]: t96FQf6u001309: to=<aqiang831214@163.com>, ctladdr=<zkq@backup-11> (500/500), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120620, relay=163mx02.mxmail.netease.com. [220.181.14.147], dsn=5.0.0, stat=Service unavailable
Oct  6 23:26:41 backup-11 sendmail[1311]: t96FQf6u001309: t96FQf6u001311: DSN: Service unavailable
Oct  6 23:26:41 backup-11 sendmail[1311]: t96FQf6u001311: to=<zkq@backup-11>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31818, dsn=2.0.0, stat=Sent
Oct  6 23:30:01 backup-11 sendmail[1346]: My unqualified host name (backup-11) unknown; sleeping for retry
Oct  6 23:30:55 backup-11 sendmail[1368]: My unqualified host name (backup-11) unknown; sleeping for retry
Oct  6 23:31:55 backup-11 sm-msp-queue[1377]: My unqualified host name (backup-11) unknown; sleeping for retry
Oct  6 23:31:58 backup-11 sendmail[1372]: t96DlpHC039178: to=<18919190378@189.cn>, ctladdr=<zkq@backup-11> (500/500), delay=01:44:06, xdelay=00:00:03, mailer=esmtp, pri=480616, relay=mta-189.21cn.com. [183.61.185.69], dsn=4.4.2, stat=Deferred
Oct  6 23:32:55 backup-11 sm-msp-queue[1377]: unable to qualify my own domain name (backup-11) -- using short name

通过查看以上日志终于让我找到了蛛丝马迹,呵呵,如下:
DSN: Service unavailable
My unqualified host name (backup-11) unknown; sleeping for retry
unable to qualify my own domain name (backup-11) -- using short name
stat=Deferred
stat=Service unavailable

通过查找资料,解决办法如下:
1.[root@backup-11 ~]# vi /etc/mail/access
# of the format of this file. (search for access_db in that file)
# package.
#
# If you want to use AuthInfo with "M:PLAIN LOGIN", make sure to h
ave the
# cyrus-sasl-plain package installed.
#
# By default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:10.0.0.11                       RELAY
Connect:192.168.0.254                       RELAY
2.在 /etc/hosts.allow 中加入以下行:
sendmail : backup-11  #主机名
sendmail : 10.0.0.11  #发送邮件服务器IP地址
3.可以用hostanme 命令临时修改主机名,hostname aa.com;
4.[root@backup-11 ~]# vi /etc/mail/sendmail.cf
找到:
# SMTP daemon options
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
添加:
# SMTP daemon options
O DaemonPortOptions=Port=smtp,Addr=你的IP, Name=MTA
保存!

切记:修改完hostname以后需要重启sendmail 服务,重启服务后,一切ok.

posted @ 2015-10-07 22:48  linuxzkq  阅读(...)  评论(...编辑  收藏