1. 程式人生 > >Windows Server2012搭建郵件伺服器

Windows Server2012搭建郵件伺服器



要搭建郵件伺服器,需要在伺服器上配置SMTP POP3服務,SMTP服務負責傳送郵件,POP3服務負責接收郵件。

Windows Server 2003中提供了POP3服務元件,但是到了 Windows Server 2012中,POP3元件已經不再是系統功能中的

一項,只有 SMTP服務了,所以這裡我們使用 Windows Server 2012自帶的 SMTP服務配合一個第三方的 POP3服務搭建我

們的郵件伺服器。

我們首先在Microsoft Azure中國區建立一臺 ARM虛擬機器,系統選擇 Windows Server 2012,先不選擇網路安全組。如果

使用其他雲平臺或者本地伺服器,則注意在防火牆中放行我們後面用到的

SMTP POP3埠即可。

接著我們來搭建SMTP伺服器,在伺服器管理器(Server Manager)中選擇“新增角色/功能”(Add Rolesand Features):

Server Manager Dashboard WELCOME TO SERVER MANAGER Dashboard Local Server All Servers Manage Tools View Help Add Roles and Features Remove Roles and Features Add Servers Create Server Group O Configure Server Manager Properties File and Storage Services io IIS QUICK START 2 3 WHAT'S NEW 4 5 N MORE Add roles and features Add other servers to manage Create a server group Connect this server to cloud servi

在彈出的“新增角色/功能”嚮導中找到功能(Feature)中的 SMTP Server 一項,勾選後會提示需要安裝一些依賴的組

件,確認即可:

Select features Before You Begin Installation Type Server Selection Server Roles Web Server Role (IIS) Role Services Confirmation Add Roles and Features Wizard Select one or more features to install on the selected server. RAS Connection Manager Administration Kit (C Remote Assistance Remote Differential Compression Remote Server Administration Tools RPC over HTTP Proxy Simple TCP/IP Services SMS I.O/CIFS File Sharing Support (Installed) SMS Bandwidth Limit SMTP Serve SNMP Sevice Telnet Client Telnet Selver TFTP Client user Interfaces and Infrastructure (2 of 3 installe DESTINATION SERVER Description SMTP Server supports the transfer of e-mail messages between e-mail systems. Cancel

安裝完成後,在開始選單中找到6.0版本

Search Everywhere v Internet Information Services (IIS) Manager Internet Information Services (IIS) 60 Manager

開啟後,展開 SMTPVirtual Server,新增一個新的 Domain

Internet Information Services (IIS) 6.0 Manager File Action View Window Help Internet Information Services DANSERVER2012 (local computer) [SMTP Curr Domain Nam Domain... Type Local (Default) New Window from Here Refresh Export List... Help

新的Domain我們選擇Alias,即為我們本機的域新增一個別名:

New SMTP Domain Wizard Welcome to the New SMTP Domain Wizard use this wizard to create a new domain on this SMTP virtual server Specify the domain Type @ Alias Back

這一步我們需要填寫我們自己的公網域名(這個域名會作為我們後續使用的郵箱字尾使用):

New SMTP Domain Wizard Domain Name What is the address space of mail that is to be received by this domain? (For example microsoft com) 2draamcomcn

接著我們配置 SMTPVirtual Server屬性:

Internet Information Services (IIS) 6.0 Manager File Action View Window Help Internet Information Services DANSERVER2012 (local computer) Domains [SMTPVi Doma Curre Start Stop Pause View New Window from Here Rename Refresh Export List... Properties Help

從安全性考慮,修改SMTP服務的偵聽埠為60025

[SMTP Virtual Server #1] Properties General Access Messages Delivery LDAP Routing Security Fully-qualified domain name Dan Server2012 IP address: (Al Unassigned) r Limit number of connections to Connection time-out (mnutes) Enable Bgg'ng Active log format: W3C Log File Format Advanced Configure multiple dentities for this vinual server Address: IP %dress fAI Unassigned: TCP Port Properties m *ppb'

在連線控制(Connection control)和中繼限制(Relay restrictions)中新增允許的客戶端IP地址(如果想全部放行,

就選擇Allexcept the list below):

[SMTP Virtual Server #1] Properties General Access Messages Delivery LDAP Routing Security Edit the authentication methods for this resource TLS is not available without a certificate encryption Grant or deny access to this rasouce using IP addresses or Intamat domain names Relay restrictions Grant or deny permissions to relay snail through this SMTP virtual server Relay

Connection Select which computers may access this virtual server Only the list below Al except the list below Computers Granted Granted IP Address Remove / Domain Name

Relay Restrictions Select which computer may relay through this Vitual server Only the list below Al except the list below Computers IP Address Granted Granted Remove / Domain Name r Alow all computers which successfully authenticate to relay. regardless of the ist above

其他選項暫時可以保持預設,點選確認儲存設定。

接著我們搭建POP3郵件伺服器,這裡我們選擇Visendo SMTPExtender,一個免費的第三方POP3伺服器。

下載地址:https://visendo-smtp-extender-plus.en.softonic.com/

使用預設選項安裝即可,安裝完成後,首先建立一個郵箱賬號:

Settings 8:) Accounts Advanced 'O Support Info Update Visendo SmtpExtender Plus v1.1.2.637 Demo x64 Accounts Account IT4ew Account: Mails Size (KB) O Mails. 000 KB

郵箱字尾寫我們的自定義域名:

Visendo SmtpExtender account wizard Choose single account to receiva anails for ona address only A domain account collects anailsfor all addresses of a domain O account The recipient S enail address is also used as user name for PO 93 login E-Mail address daniaI@2dreamcomcn < Back jeFnsh—sÅ —Cancel—h

接著配置POP3服務埠號以及Email Drop Folder

Visendo SmtpExtender Plus v1.1.2.637 Demo x64 Settings Accounts Advanced "O Support Info Update Advanced Use following IP Email drop folder (Cannot bind to localhost / 127 0 0 1) SM TP is monitoring this folder moving em' files to their respective account folders C] Do not process emails if Oast file change) older than O days Settings path O hours Config files are saved here Ing files are created in the subfolder ' 'logs" logging level medium Advanced Settings E- Mail Header Fields

啟動服務:

Visendo SmtpExtender Plus v1.1.2.637 Demo x64 Settings 8:) Accounts Advanced 'O Support Info Update Settings Service status Running

完成後確認關閉。

接著需要給這臺Server新增一個公網的DNS名稱(這裡這個DNS名稱不是必須的,如果你的MX記錄使用指向的是這臺虛擬機器的公網IP地址的話,就不需要這裡為其配置DNS名稱了)

DanServer2012-ip Search (Ctr/+D IP 2471 '*95 IP ±Ripconfig1 42.159.247.124 4 DNS • danmail .chinaeast.cloudapp.chinacloudapi .cn

在自定義域名的地方新增一條MX記錄:

TTL MX danmail.chinaeast.cloudapp.chinaclou dapi.cn

完成後,在 Outlook客戶端中配置 POP/SMTP郵箱:

Ellen Adams ellen@contoso.com Internet

選擇POP型別:

o Microsoft Exchange Server C) Outlook.com Exchange ActiveSync @ POP IMAP(P) BEJ POP IMAP

配置賬戶資訊:

POP 'MAP RFE(U): daniel daniel@2dream.com.cn pops danmail .chinaeast.cloudapp.l danmail .chinaeast.cloudapp.l daniel@2dream.com.cn

配置POP3 SMTP埠資訊:

| nternet 電 子 白 阝 件 訁 殳 置 常 規 發 送 器 高 級 服 器 囗 號 接 器 (POP 995 使 用 默 認 ( D ) 囗 此 服 器 要 求 加 SSL ) ( E ) 發 送 器 ( SMT 0 ) : 60 巾 5 使 用 以 下 加 型 ( C) : 服 器 超 田 長 1 分 在 器 上 保 的 副 ( L ) 天 舌 服 器 上 的 副 ) 14 囗 ' 已 聳 · . 同 服 器 上 的 副 ( M )

測試完成:

祝 鷲 您 ! 已 完 有 試 。 適 望 擊 ' 關 到 . 繼 。 丿 登 錄 到 身 妾 收 # 服 務 器 〔 ) 丿 發 送 試 毛 子 0 # 0 停 止 〔 S 〕 0 〔 0

測試郵件傳送功能:

2017/3/20 23:27 daniel <daniel@2dream.com.cn> test 'killerhx@126.com' test

test daniel 23:27 test

接收郵件:

計算機生成了可選文字:笞 復 至 都 笞 復 轉 發 2017 / 釤 20 〔 周 一 〕 2 引 49 killer «killerhx@126 om > Re:test 收 # 人 damel O 如 果 顯 丁 此 葺 # 的 方 有 閆 題 , 舀 此 處 以 在 Web 瀏 覽 器 中 音 該 # At 2017 一 03 一 20 23 〕 27 〕 12 'daniel" <0旦n壟!@2豇e旦m壟Q_m工0> wrote. t e s t