[精讚] [會員登入]
5003

[CentOS6] 設定 sendmail

Centos6上設定sendmail,基本上sendmail會設定多半是為了寄系統信和收垃圾信(喂!!?)

分享此文連結 //n.sfs.tw/11335

分享連結 [CentOS6] 設定 sendmail@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-25 14:23:58 最後編修
2017-06-19 11:15:11 By 張○○
 

自動目錄

簡單的設定sendmail,基本上讓外面能寄信進來,自己也能寄出去(雖然會變垃圾信)

OS

CentOS6 Linux n.sfs.tw 2.6.32-358.el6.x86_64 #1

安裝

# yum install sendmail m4 sendmail-cf

設定監聽埠

修改 /etc/mail/sendmail.mc 約116行,把127.0.0.1改為0.0.0.0,這樣子外面才能寄信近來

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl

編碼

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

設定允許寄信網段

允許192.168.1.0/24及163.17.1.1,這是允許這段IP能用此伺服器寄出,可設定多筆

# vim /etc/mail/access

Connect:192.168.1                       RELAY
Connect:163.17.1.1                      RELAY

將access檔案內容寫入db檔案

#  makemap hash /etc/mail/access.db </etc/mail/access

設定網域名稱 vi /etc/mail/local-host-names

n.sfs.tw
mail.n.sfs.tw

重啟及檢查

# service sendmail restart

查看是否有啟動
# netstat -at | grep smtp
tcp        0      0 *:smtp                      *:*                         LISTEN

如有啟動失敗,檢查是否postfix已經開啟

# service postfix stop

防火牆25埠是否有開? 沒開只能寄不能收,先關看看

# service iptables stop

SELINUX的問題?先關試試

# setenforce 0

參考資料

[1] http://marcustsai.blogspot.tw/2010/11/sendmail.html


原文 2013-07-22 14:10:06

END

你可能感興趣的文章

[Centos7] SSL自簽憑證+APACHE+Selinux SSL的自簽憑證

[postfix] open /etc/postfix/main.cf: Permission denied 等錯誤 遇到開啟 /etc/postfix/main.cf: Permission denied 等錯誤解決

TFTP Server 安裝及使用 讓設備的網路設定檔或是韌體經由TFTP拷備出來,操作的方法

[Centos7] 安裝 semanage (selinux工具程式) 安裝selinux的工具程式 semanage

Centos7 安裝 docker-composer 及使用 docker compose 是使用docker的利器,可以讓很多的指令用文檔的方式載入。

[CentOS] 新增修改及刪除使用者 新增、修改、刪除使用者和群組

隨機好文

UTF-8 BOM (Byte Order Mark) 的問題 在 Michael Kaplan 那看到 Every character has a story #4: U+feff

魔球中小女孩唱的歌 The show 魔球中小女孩唱的歌 The show

[Wildfly10] 發佈war檔 deploy war file onto wildfly10

「許功蓋」的字以及源由 有玩過電腦一段時間的人,都聽過這個人(有一天我才發現7年級的竟然都不認識這個

[AS3] 變數型態 基本類型宣告 as3 有下列幾種基本類型:string, int, number, object, boolean, n