OS X 伺服器:啟用和停用電子郵件自動轉寄

OS X 伺服器的「郵件」伺服器功能可自動轉寄使用者的電子郵件。

OS X 伺服器(Mountain Lion)指示

  1. 在 Server.app 中,前往「使用者」並選取一個使用者。

  2. 按一下齒輪圖像(或按住 Control 鍵並按一下使用者名稱),然後選擇「編輯郵件選項…」

  3. 從「電子郵件應為:」彈出式選單中,選取「轉寄」。

  4. 在「至電子郵件地址:」欄位中輸入轉寄電子郵件地址。

Lion Server 指示

啟用帳號的自動轉寄功能

若要讓帳號自動轉寄,請在伺服器的「終端機」中執行下列指令。第一個指令會讓你進入互動模式。

sudo serveradmin command mail:command = setAutoForward mail:userID = (the_users_shortname) mail:fwdAddress = (the_emailaddress_to_forward_to_)

按下 Control-D 完成指令。

按下 Control-D 完成指令後,應會傳回 userID、GUID 和新設定的自動轉寄地址。例如:

mail:userID = " mailuser1"

mail:userGUID = "A961DAFE-2FE5-4EEC-A2CB-CB6511E9B28D"

mail:fwdAddress = "my-user-ID@example.com"

如果使用者不存在,系統會傳回下列訊息:

mail:error = "user not found"

停用帳號的自動轉寄功能

請使用與上述相同的指令,但地址值為空:

sudo serveradmin command mail:command = setAutoForward mail:userID = mailuser1 mail:fwdAddress = ""

按下 Control-D 完成指令。

回應會與上述相同,但 mail:fwdAddress 為空。範例:

mail:userID = " mailuser1"

mail:userGUID = "A961DAFE-2FE5-4EEC-A2CB-CB6511E9B28D"

mail:fwdAddress = ""

如果使用了不正確的 ID 或 ID 不存在,系統會傳回以下訊息:

mail:error = "user not found"

查看目前哪些帳號已啟用自動轉寄功能

執行以下指令:

sudo serveradmin command mail:command = getAutoForward

此指令會傳回使用者 GUID 和自動轉寄地址列表。例如:

$ sudo serveradmin command mail:command = getAutoForward

mail:1080C8CF-5432-4302-B3B7-0EEFB79106AD:fwdAddress = "my-userID-1@example.net"

mail:2DD1FB33-340F-408F-8C2A-D77B0A2431C7:fwdAddress = "my-userID-2@example.net"

更多內容

或者,你也可以使用 set_user_mail_opts 指令。請參閱 man set_user_mail_opts 以了解使用方式和選項。

發佈日期: