歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> linux系統SendMail詳細配置

linux系統SendMail詳細配置

日期:2017/3/2 16:43:16   编辑:Linux服務器

1、 安裝相關服務
DNS
Mailserver(sendmail、imap)
2、 啟動相關服務
Service named restart
Service sendmail restart


Service xinetd restart
Chkconfig ipop3 on
3、 配置DNS,添加MX紀錄
配置DNS略
正/反向區間文件添加MX紀錄
IN MX 10(優先級) mail.anniey.com
Mail IN A 192.168.1.100
4、 主配置文件
/etc/mail/sendmail.cf
搜索/smtp
Port=smtp,Addr=192.168.1.100
5、 接受域配置文件
Vi /etc/mail/local-host-names
添加
Anniey.com
192.168.1.100
6、中繼轉發配置文件
/etc/mail/access.db(不可訪問)
Vi /etc/mail/access
添加
Anniey.com
192.168.1
退出
Makemap hash access.db < access
6、 添加用戶
Useradd user01
Passwd user01

Useradd user02
Passwd user02
7、 重啟服務
Service sendmail restart
Service xinetd restart

補:郵件用戶別名,郵件域別名
A)用戶別名
1、Vi /etc/aliases
別名 用戶名
A01 user01
A02 user02
退出
2、Newaliases

B)郵件域別名
1、配置相關DNS略
2、添加域別名
Vi /etc/mail/sendmail.cw
Anniey.com
Johnny.com
退出
3、接受域配置文件
Vi /etc/mail/local-host-names
Anniey.com
Johnny.com
192.168.1.100
4、重啟服務
Service named restart
Service sendmail restart
Service xinetd restart

補:啟用smtp認證
1、 安裝相關模塊
Rpm –qa | grep sasl
Linux盤中:RedHat—〉RPMS—>sasl*
2、 修改 /etc/mail/sendmail.mc(sendmail.cf的源代碼)
Vi /etc/mail/sendmail.mc
查詢:43 TRUST_AUTH*
:44
:85 DAEMON_OPTION*
:92 DAEMON*
注:去掉dnl(注釋)
3、 生成sendmail.cf
M4 sendmail.mc >sendmail.cf
4、刪除部分中繼,以免開後門
5、客戶機
我的服務器要求身份驗證

經過以上步驟後,應該就可以用Outlook Express正常發送郵件了,但這時還不能用Outlook Express從服務器端收取郵件的,因為sendmail默認狀態並不具備POP3功能,我們還得自己安裝並啟用它。
1、安裝pop3服務
  rpm -qa imap
  imap-2001a-18
  rpm -ivh imap-2001a-18.i386.rpm
  2.啟用POP3服務。
  POP3服務:請先修改/etc/xinetd.d/ipop3文件,將其中的disable=yes改為disable=no後保存;然後重新啟動xinetd程序來讀取這個修改過的配置文件,使之生效。
  /etc/rc.d/init.d/xinetd restart

Copyright © Linux教程網 All Rights Reserved