Postfix 使用 hiBox 寄信

hiBox 是中華電信針對企業用戶的郵件服務,也是 DR 所在的公司目前使用的郵件服務。由於最近 DR 要試驗一些網站服務,其中會涉及對外寄信的功能,因此 DR 想到如果能設定 Postfix 利用 hiBox 來寄信,如此一來就會省事很多。

 

於是 DR 主要參考了自己好些年前寫的 Postfix 使用 Gmail SMTP 轉寄這篇文章(內容陳舊,有興趣閱讀的人切勿照單全收),不過也發現用 hiBox 寄信所需的設定內容事實上是單純很多,本文接下來的內容便是在 CentOS 6.4 上的設定流程。

 

首先建立 /etc/postfix/sasl_passwd,並在裡頭寫入一個有效的 hiBox 郵件帳號、網域及密碼,按照下列格式:

www.hibox.hinet.net username@domain.com:password

 

然後執行 postmap 建立資料庫:

  • postmap hash:/etc/postfix/sasl_passwd

 

接著編輯 /etc/postfix/main.cf,寫入以下內容:

myorigin = domain.com

relayhost=[www.hibox.hinet.net]

smtp_sasl_auth_enable=yes

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

smtp_sasl_security_options = noanonymous

 

myorigin 參數要確實填寫申辦 hiBox 所用的網域名稱,否則會直接被 hiBox 拒絕。儲存設定後,重新啟動 Postfix,用 mail 指令寄封測試信,再檢查 maillog 確認被 hiBox 接受就完成了。

 

SELinux 部份,要使用網頁寄信記得要開放相關權限:

  • setsebool -P httpd_can_sendmail=1

 

 

分類: