各位前辈,小弟在Linux配置Sendmail时,遇到一个很奇怪的问题:配置完成后,可以往给外网的邮箱,比如163.com,但是却一直无法发给公司内部的Exchange邮箱,
尝试了几天一直未能解决,还请各位帮忙分析分析!
具体情况如下: 需求:希望能从Linux 主机上发邮件给用户邮箱,以便在系統發生問題時進行Mail告警,或者應用系統會定時發 一些報表等給指定的人員。 環境:1. Linux 版本 Redhat 5.3 2.6.18 2. 公司的一台Exchange 2003 Server,供公司內外部郵件應用, 3. 公司有統一的AD系統,統一域名,建立有內部的Windows DNS Server,Linux主機也采用此DNS Server 已進行配置: 1. /etc/hosts [root@erptest02 mail]# more /etc/hosts
# that require network functionality will fail.
127.0.0.1 localhost.localdomai localhost
192.168.120.67 erptest02.test.com erptest02 此為Linux 主機的IP及機器名
192.168.120.54 mail01.test.com mail01 此為exchange Server 的IP及機器名 2. /etc/mail/access [root@erptest02 mail]# more access
# by default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:192.168.120 RELAY 此為公司服務器所在網段, 3. /etc/mail/sendmail.mc 進行了如下設定: TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
取消了此兩行前的註釋 將DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 改為
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl 4. 在DNS Server上添加了 此Linux 主機的主機記錄和MX記錄 在Linux 主機上可以成功解析得到 Exchange Server 和Linux 主機的MX 記錄 [root@erptest02 mail]# nslookup -type=mx 192.168.120.67
Server: 192.168.120.230
Address: 192.168.120.230#53 67.120.168.192.in-addr.arpa name = erptest02.test.com. [root@erptest02 mail]# nslookup -type=mx 192.168.120.54
Server: 192.168.120.230
Address: 192.168.120.230#53 54.120.168.192.in-addr.arpa name = mail01.test.com. [root@erptest02 mail]#
5. 重新 m4 sendmail.cf 和 make access.db的,有重啟 Sendmail服務
问题点:
但通过命令mailx 測試发送郵件時发现, 可以成功发送到外网的邮箱,比如163邮箱,但在发送到自己的exchange邮箱时,总是
报 550 5.1.1 <suny_zhu@test.com>... User unknown 无法成功送出。
详细信息如下:
[root@erptest02 mail]# mailx -v -s "Test From erptest02" suny_zhu@test.com < /tmp/test
suny_zhu@test.com... Connecting to [127.0.0.1] via relay...
220 erptest02.test.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 19 Oct 2010 19:39:52 +0800
>>> EHLO erptest02.test.com
250-erptest02.test.com Hello localhost.localdomai [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH LOGIN PLAIN
250-DELIVERBY
250 HELP
>>> MAIL From:<root@erptest02.test.com> SIZE=129 AUTH=root@erptest02.test.com
250 2.1.0 <root@erptest02.test.com>... Sender ok
>>> RCPT To:<suny_zhu@test.com>
>>> DATA
550 5.1.1 <suny_zhu@test.com>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
root... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1153
250 2.1.0 <>... Sender ok
>>> RCPT To:<root@erptest02.test.com>
>>> DATA
250 2.1.5 <root@erptest02.test.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 o9JBdqkW027386 Message accepted for delivery
root... Sent (o9JBdqkW027386 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 erptest02.test.com closing connection
[root@erptest02 mail]# mailx -v -s "Test From erptest02" suny628@163.com < /tmp/test
suny628@163.com... Connecting to [127.0.0.1] via relay...
220 erptest02.test.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 19 Oct 2010 19:40:58 +0800
>>> EHLO erptest02.test.com
250-erptest02.test.com Hello localhost.localdomai [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH LOGIN PLAIN
250-DELIVERBY
250 HELP
>>> MAIL From:<root@erptest02.test.com> SIZE=123 AUTH=root@erptest02.test.com
250 2.1.0 <root@erptest02.test.com>... Sender ok
>>> RCPT To:<suny628@163.com>
>>> DATA
250 2.1.5 <suny628@163.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 o9JBewoY027397 Message accepted for delivery
suny628@163.com... Sent (o9JBewoY027397 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 erptest02.test.com closing connection
You have new mail in /var/spool/mail/root
[root@erptest02 mail]#
请各们前辈帮忙分析分析,问题出在哪里? 要如何解决?
或者有其他更简便的方案满足我从Linux主机发邮件到内部Exchange 的要求?
先谢谢大家了!~
|