/go/forward sets up email forwarding for a single mailbox. After you set it, mail sent to info@example.com goes to the address you chose. You can turn forwarding off again with the delete action. The command saves the setting in GoAdmio's mail database and then runs vmail in the background, which rebuilds the Postfix and Dovecot mail maps so that the change is used. It takes a few seconds before the change is live. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Forward mail for info@example.com to another address
/go/forward info@example.com owner@example.org
Arguments
| Position | Argument | Required | Notes |
|---|---|---|---|
| 1 | <email> |
Yes | The mailbox whose mail is forwarded. To set forwarding it must contain @. |
| 2 | <forward-to> |
To set | The address that receives the mail. When removing, pass any value ("" works). |
| 3 | [domain] |
No | Accepted, but not used by the script. Pass it when removing, so that delete lands in position 4. |
| 4 | delete |
To remove | Removes forwarding. Any other value, or none, sets forwarding. |
| You type | Result |
|---|---|
/go/forward info@example.com owner@example.org |
Sets forwarding. |
/go/forward info@example.com "" example.com delete |
Removes forwarding. |
/go/forward info@example.com delete |
Sets forwarding to delete. Not a removal. |
/go/forward |
Does nothing and exits with status 1. |
/go/forward info owner@example.org |
Does nothing. The email has no @. |
Nothing is checked. The command does not test that <email> is an existing mailbox, or that <forward-to> is a valid address.
Examples
# Forward a mailbox to a personal address
/go/forward info@example.com owner@example.org
# Change where it goes
/go/forward info@example.com new-owner@example.org
# Stop forwarding (note the placeholders in positions 2 and 3, and delete in position 4)
/go/forward info@example.com "" example.com delete
# Review recent calls
tail /var/log/go/forward.log
Output
Setting forwarding:
All email sent to info@example.com will now be moved to owner@example.org.
Removing forwarding:
Mail for info@example.com will no longer be forwarded
These messages are printed even when no mailbox matched. If the arguments are wrong, the command prints nothing.
See the full reference at /go/forward and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
