歡迎您光臨本站 註冊首頁

請問:如何讓sendmail不從127.0.0.1發送郵件

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

請問:如何讓sendmail不從127.0.0.1發送郵件

而是選擇為本地ip地址
把sendmail.mc里的DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
改為DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl還是不行,
如果改成DAEMON_OPTIONS(`Port=smtp,Addr=192.168.3.2, Name=MTA')dnl就發送不出去了,郵件源碼中總是包含著localhost的字樣(即便是hostname /etc/hosts /etc/sysconfig/network都改了),發現sendmail自己關於主機名的文件local-host-name的優先順序低於系統的設置。
郵件源碼如下,高手幫忙:
Delivered-To: wanglei.ben@gmail.com
Received: by 10.151.44.8 with SMTP id w8cs1654ybj;
        Mon, 9 Aug 2010 22:32:30 -0700 (PDT)
Received: by 10.224.122.11 with SMTP id j11mr9141279qar.247.1281418349882;
        Mon, 09 Aug 2010 22:32:29 -0700 (PDT)
Return-Path: <root@wildlife.com>
Received: from localhost.localdomain ()
        by mx.google.com with ESMTP id v29si68635qco.201.2010.08.09.22.32.27;
        Mon, 09 Aug 2010 22:32:28 -0700 (PDT)
Received-SPF: error (google.com: error in processing during lookup of root@wildlife.com: DNS timeout) client-ip=211.94.145.126;
Authentication-Results: mx.google.com; spf=temperror (google.com: error in processing during lookup of root@wildlife.com: DNS timeout) smtp.mail=root@wildlife.com
Received: from wildlife.com (localhost.localdomain )
        by localhost.localdomain (8.13.8/8.13.8) with ESMTP id o7A5Z7Tv011043
        for <wanglei.ben@gmail.com>; Tue, 10 Aug 2010 13:35:08 +0800
Received: (from root@localhost)
        by wildlife.com (8.13.8/8.13.8/Submit) id o7A5Z7S6011042
        for wanglei.ben@gmail.com; Tue, 10 Aug 2010 13:35:07 +0800
Date: Tue, 10 Aug 2010 13:35:07 +0800
Message-Id: <201008100535.o7A5Z7S6011042@wildlife.com>
From: aaa@tom.com

《解決方案》

回復 1# ruger


    我的/etc/hosts文件是這樣的,我並不想從127.0.0.1發送郵件,而是想從192.168.3.2發送,但總是顯示localhost.localdomain,因此我把127.0.0.1的域名也改了:
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1              localhost.localdomain localhost
127.0.0.1               wildlife.com wildlife
192.168.3.2             wildlife.com wildlife
::1             localhost6.localdomain6 localhost6
《解決方案》

DNS問題
《解決方案》

回復 3# dexter_yccs


    是本地的dns嗎?我一直不理解為什麼需要設置本地dns?dns不是有dns伺服器設置的嗎?dns伺服器負責設置域名與ip的對應,以及mail伺服器的ip,rDNS什麼的,本地的sendmail負責發送郵件,難道sendmail先去dns伺服器查詢自己是否具備發送郵件的許可權,如果不具備就是用127.0.0.1發送?
不明白啊~~再解釋解釋,謝謝~~~
《解決方案》

127 的 hosts 也敢亂改。
《解決方案》

回復 5# vermouth


    瞎改瞎改,為了能成功,怎麼改都行,終於等到一個回帖的了,還有個問題,
如果我的域名是aaatest.com,但是我的MX記錄是mail1.aaatest.com這樣沒關係吧?
《解決方案》

/etc/mail/local-host-names
《解決方案》

回復  vermouth


    瞎改瞎改,為了能成功,怎麼改都行,終於等到一個回帖的了,還有個問題,
如果我 ...
ruger 發表於 2010-08-10 17:00 http://bbs.chinaunix.net/images/common/back.gif


        MX是針對域的,mx後面的mail1.example.com是主機,將mail1指定A記錄到ip就行了
LZ對DNS還不是很熟悉
《解決方案》

回復 8# ruochen


    哦,多謝,明白了,MX記錄只是告訴域裡面mail1.aaatest.com的域名為mail服務,而具體的IP地址使用A來設置就行了,學習了~~~
《解決方案》

實際上後面出錯的部分(郵件源碼)是SPF機制未通過校驗,總是出現localhost和127.0.0.1的字樣

[火星人 ] 請問:如何讓sendmail不從127.0.0.1發送郵件已經有764次圍觀

http://coctec.com/docs/service/show-post-16860.html