Languages

OS X Server: Enabling and disabling email auto-forwarding

OS X Server's Mail server feature can automatically forward email for users.

OS X Server (Mountain Lion) instructions

  1. In Server.app, go to Users and select a user.
  2. Click the gear icon (or Control-click the user name) and choose "Edit Mail Options..."
  3. From the "Mail should be:" pop-up menu, select "forwarded".
  4. Enter the forwarding email address in the "to email address:" field.

Lion Server instructions

Enabling auto-forwarding for an account

To enable an account for auto-forwarding, run the following commands in Terminal on the server. The first command puts you in interactive mode.

 

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

 

Press Control-D to complete the command.
After completing the command by pressing Control-D, it should return the userID, GUID and the newly set auto-forward address. For example:
mail:userID = " mailuser1"
mail:userGUID = "A961DAFE-2FE5-4EEC-A2CB-CB6511E9B28D"
mail:fwdAddress = "my-user-ID@example.com"


If the user does not exist, the following message will be returned:
mail:error = "user not found"

To disable auto-forwarding for an account

Use the same commands as above, but with an empty address value:

 

sudo serveradmin command

mail:command = setAutoForward

mail:userID = mailuser1

mail:fwdAddress = ""

 

Press Control-D to complete the command.

The response will be the same as above but the mail:fwdAddress will be empty. Example:
mail:userID = " mailuser1"
mail:userGUID = "
A961DAFE-2FE5-4EEC-A2CB-CB6511E9B28D"
mail:fwdAddress = ""


If an incorrect ID was used or does not exist, the following message will be returned:
mail:error = "user not found"

To see which accounts currently are being auto-forwarded

Execute this command:

 

sudo serveradmin command mail:command = getAutoForward

 

The command returns a list of user GUIDs and the auto-forward addresses. For Example:
$ 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"

Learn more

As an alternative, you can also use the set_user_mail_opts command. See man set_user_mail_opts for usage and options.

Last Modified: Jul 14, 2014
Helpful?
Yes
No
  • Last Modified: Jul 14, 2014
  • Article: HT5032
  • Views:

    null

Additional Product Support Information

Start a Discussion
in Apple Support Communities
See all questions on this article See all questions I have asked