<acronym id="s8ci2"><small id="s8ci2"></small></acronym>
<rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
<acronym id="s8ci2"></acronym>
<acronym id="s8ci2"><center id="s8ci2"></center></acronym>

您好,歡迎來電子發燒友網! ,新用戶?[免費注冊]

您的位置:電子發燒友網>電子百科>電腦硬件>服務器>

如何搭建本地smtp服務器

2018年04月08日 14:46 網絡整理 作者: 用戶評論(0

  搭建本地smtp服務器教程

 ?。ㄒ唬┌惭bPOP3和SMTP服務組件

  WindowsServer2003默認情況下是沒有安裝POP3和SMTP服務組件的,因此要手工添加。

  1.安裝POP3服務組件

  以系統管理員身份登錄WindowsServer2003系統。依次進入“控制面板→添加或刪除程序→添加/刪除Windows組件”,在彈出的“Windows組件向導”對話框中選中“電子郵件服務”選項,點擊“詳細信息”按鈕,可以看到該選項包括兩部分內容:POP3服務和POP3服務Web管理。為方便用戶遠程Web方式管理郵件服務器,建議選中“POP3服務Web管理”。

  2.安裝SMTP服務組件

  選中“應用程序服務器”選項,點擊“詳細信息”按鈕,接著在“Internet信息服務(IIS)”選項中查看詳細信息,選中“SMTPService”選項,最后點擊“確定”按鈕。此外,如果用戶需要對郵件服務器進行遠程Web管理,一定要選中“萬維網服務”中的“遠程管理(HTML)”組件。完成以上設置后,點擊“下一步”按鈕,系統就開始安裝配置POP3和SMTP服務了。

 ?。ǘ┡渲肞OP3服務器

  1.創建郵件域

  點擊“開始→管理工具→POP3服務”,彈出POP3服務控制臺窗口。選中左欄中的POP3服務后,點擊右欄中的“新域”,彈出“添加域”對話框,接著在“域名”欄中輸入郵件服務器的域名,也就是郵件地址“@”后面的部分,如“rtj.net”,最后點擊“確定”按鈕。其中“rtj.net”為在Internet上注冊的域名,并且該域名在DNS服務器中設置了MX郵件交換記錄,解析到WindowsServer2003郵件服務器IP地址上。

  2.創建用戶郵箱

  選中剛才新建的“rtj.net”域,在右欄中點擊“添加郵箱”,彈出添加郵箱對話框,在“郵箱名”欄中輸入郵件用戶名,然后設置用戶密碼,最后點擊“確定”按鈕,完成郵箱的創建。

 ?。ㄈ┡渲肧MTP服務器

  完成POP3服務器的配置后,就可開始配置SMTP服務器了。點擊“開始→程序→管理工具→Internet信息服務(IIS)管理器”,在“IIS管理器”窗口中右鍵點擊“默認SMTP虛擬服務器”選項,在彈出的菜單中選中“屬性”,進入“默認SMTP虛擬服務器”窗口,切換到“常規”標簽頁,在“IP地址”下拉列表框中選中郵件服務器的IP地址即可。點擊“確定”按鈕,這樣一個簡單的郵件服務器就架設完成了。

  完成以上設置后,用戶就可以使用郵件客戶端軟件連接郵件服務器進行郵件收發工作了。在設置郵件客戶端軟件的SMTP和POP3服務器地址時,輸入郵件服務器的域名“rtj.net”即可。

  基于CentOS搭建SMTP服務器

  1、環境

 ?。踨oot@iZ11uh778whZMaildir]#uname–a

如何搭建本地smtp服務器

 ?。踨oot@iZ11uh778whZMaildir]#cat/etc/issue

如何搭建本地smtp服務器

  2、安裝posfix

  查看posfix的版本

 ?。踨oot@iZ11uh778whZMaildir]#postconfmail_version

  一般是默認就安裝了posfix的,如果沒有暗轉的話,是用yum-yinstallpostfix安裝

 ?。踨oot@iZ11uh778whZMaildir]#yum-yinstallpostfix

如何搭建本地smtp服務器

  3、更改默認郵件傳輸代理(MTA)

  查看默認的mta

 ?。踨oot@iZ11uh778whZMaildir]#alternatives--displaymta

如何搭建本地smtp服務器

  我們可以看到默認的mta就是postfix,也許是sendmail,如果不是postfix,則修改為postfix

 ?。踨oot@iZ11uh778whZMaildir]# alternatives --config mta

  There is1 program that provides ‘mta’。

  Selection Command

  -----------------------------------------------

  *+1 /usr/sbin/sendmail.postfix

  Enter to keepthe current selection[+], or type selection number: 1

如何搭建本地smtp服務器

  4、配置postfix

  Postfix的配置文件主要有:/etc/postfix/main.cf和/etc/postfix/master.cf

  我們主要修改/etc/postfix/main.cf

 ?。踨oot@iZ11uh778whZ postfix]# vim /etc/postfix/main.cf

  將#myhostname =virtual.domain.tld前面的‘#’去掉,改為

  myhostname = localhost //系統的主機名稱

  將#mydomain = domain.tld前面的‘#’去掉,改為

  mydomain = 51cs8.com //email的地址,為可用的域名

  將#myorigin = $mydomain前面的‘#’去掉,改為

  myorigin = $mydomain //指定本地發送郵件中來源和傳遞顯示的域名

  將#inet_interfaces =localhost前的‘#’去掉,改為

  inet_interfaces = all //設置網絡接口以便Postfix能接收到郵件

  將#mydestination =$myhostname, localhost.$mydomain, localhost前面的‘#’去掉,改為

  mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //指定哪些郵件地址允許在本地發送郵件

  將#local_recipient_maps = 前面的‘#’去掉,改為

  local_recipient_maps =

  將#mynetworks =168.100.189.0/28, 127.0.0.0/8前面的‘#’去掉,改為

  mynetworks = 10.47.200.0/21, 127.0.0.0/8 //根據自己內網的實際情況寫,指定受信任SMTP的列表,具體的說,受信任的SMTP客戶端允許通過Postfix傳遞郵件

  將#home_mailbox = Maildir前面的‘#’去掉,改為

  home_mailbox = Maildir/ //設置郵箱路徑與用戶目錄有關,也可以指定要使用的郵箱風格。

  將#smtpd_banner = $myhostnameESMTP $mail_name ($mail_version)前面的‘#’去掉,改為

  smtpd_banner = $myhostname ESMTP unknow //不顯示SMTP服務器的相關信息

  在配置文件的最后追加如下內容:

  #smtpd

  smtpd_sasl_auth_enable = yes //使用smtp認證

  broken_sasl_auth_clients = yes //讓不支持RFC2554的smtpclient也可以跟postfix做交互。

  smtpd_sasl_local_domain = $myhostname //指定SMTP認證的本地域名

  smtpd_sasl_security_options = noanonymous //取消匿名登陸方式

  smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination //設定郵件中有關收件人部分的限制

  5、安裝cyrus-sasl、cyrus-imapd相關包

 ?。踨oot@localhost ~]#yum -y install cyrus*

如何搭建本地smtp服務器

  因為我之前安裝過,所提提示已經安裝。

  6、配置cyrus-sasl

  Cyrus-sasl的配置文件路徑:/etc/sasl2/smtpd.conf

 ?。踨oot@iZ11uh778whZ postfix]# vim /etc/sasl2/smtpd.conf

  在文件尾部追加

  log_level: 3 //記錄log的模式

  saslauthd_path:/var/run/saslauthd/mux //設置一下smtp尋找cyrus-sasl的路徑

  下面是我/etc/sasl2/smtpd.conf的內容:

  pwcheck_method: saslauthd

  mech_list: plain login

  log_level: 3

  saslauthd_path: /var/run/saslauthd/mux

  7、啟動postfix、cyrus-sasl、cyrus-imapd

 ?。踨oot@iZ11uh778whZ postfix]# /etc/init.d/postfix restart

  Shutting down postfix: [ OK ]

  Starting postfix: [ OK ]

 ?。踨oot@iZ11uh778whZ postfix]# /etc/init.d/saslauthd restart

  Stopping saslauthd: [ OK ]

  Starting saslauthd: [ OK ]

 ?。踨oot@iZ11uh778whZ postfix]# /etc/init.d/cyrus-imapd restart

  Shutting down cyrus-imapd: [ OK ]

  Exporting cyrus-imapd databases: [ OK ]

  Importing cyrus-imapd databases: [ OK ]

  Starting cyrus-imapd: [ OK ]

  查看smtp啟動情況:

 ?。踨oot@iZ11uh778whZ postfix]# netstat -tpnl | grep 25

  tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1714/master

  查看imap啟動情況:

 ?。踨oot@iZ11uh778whZ postfix]# netstat -tpnl | grep cyrus

  tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 2687/cyrus-master

  tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 2687/cyrus-master

  tcp 0 0 0.0.0.0:4190 0.0.0.0:* LISTEN 2687/cyrus-master

  tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 2687/cyrus-master

  tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 2687/cyrus-master

  8、設置postfix、cyrus-sasl、cyrus-imapd開機自啟動

 ?。踨oot@iZ11uh778whZ postfix]# chkconfig postfix on

 ?。踨oot@iZ11uh778whZ postfix]# chkconfigpostfix --list

  postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off

 ?。踨oot@iZ11uh778whZ postfix]# chkconfig saslauthd on

 ?。踨oot@iZ11uh778whZ postfix]# chkconfigsaslauthd --list

  saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

 ?。踨oot@iZ11uh778whZ postfix]# chkconfig cyrus-imapd on

 ?。踨oot@iZ11uh778whZ postfix]# chkconfig cyrus-imapd--list

  cyrus-imapd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

  9、測試cyrus-sasl

  添加賬號、密碼 system | system

 ?。踨oot@iZ11uh778whZ postfix]# useradd system

 ?。踨oot@iZ11uh778whZ postfix]# passwd system

  Changing password for user system.

  New password:

  BAD PASSWORD: it is based on a dictionaryword

  BAD PASSWORD: is too simple

  Retype new password:

  passwd: all authentication tokens updatedsuccessfully.

  測試是否可用

 ?。踨oot@iZ11uh778whZpostfix]# testsaslauthd -u system -p system

  0: OK “Success.”

  10、測試cyrus-imapd

  安裝完cysus-imapd會自動產生一個管理賬號cyrus,所屬用戶組是mail

 ?。踨oot@iZ11uh778whZ tank]# id cyrus

  uid=76(cyrus) gid=12(mail)groups=12(mail),76(saslauth)

  將賬戶system的所在組切換到mail組

 ?。踨oot@iZ11uh778whZ tank]# usermod -g 12 system

 ?。踨oot@iZ11uh778whZ tank]# id system

  uid=502(system) gid=12(mail)groups=12(mail)

  添加測試賬號:

 ?。踨oot@iZ11uh778whZtank]# cyradm -u cyrus localhost --auth plain

非常好我支持^.^

(2) 100%

不好我反對

(0) 0%

( 發表人:姚遠香 )

      發表評論

      用戶評論
      評價:好評中評差評

      發表評論,獲取積分! 請遵守相關規定!

      ?
      亚洲欧美日韩精品久久_久久精品AⅤ无码中文_日本中文字幕有码在线播放_亚洲视频高清不卡在线观看
      <acronym id="s8ci2"><small id="s8ci2"></small></acronym>
      <rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
      <acronym id="s8ci2"></acronym>
      <acronym id="s8ci2"><center id="s8ci2"></center></acronym>