forward
Set or remove forwarding for one email address, so that mail sent to it goes to another address, then rebuild the mail maps
- Command:
/go/forward - Category: Mail
- Required arguments:
<email>and<forward-to> - Output: One confirmation line
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/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.
[!WARNING] To remove forwarding,
deletemust be the fourth argument./go/forward info@example.com deletedoes not delete anything. It sets forwarding to a destination nameddelete. See Arguments.
Quick start
# Forward mail for info@example.com to another address
/go/forward info@example.com owner@example.org
Syntax
# Set forwarding
/go/forward <email> <forward-to> [domain]
# Remove forwarding
/go/forward <email> <placeholder> <domain> delete
The command writes the call and a timestamp to /var/log/go/forward.log.
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.
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.
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
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing is printed and nothing changes | No arguments were given, or the address has no @. |
Give a full email address. |
| The confirmation is shown, but mail is not forwarded | The mailbox does not exist, so no record was changed. | Create it with mail, then run again. |
| Mail is not forwarded right away | The mail maps are rebuilt in the background. | Wait a few seconds. |
screen: command not found |
screen is not installed, so vmail could not start. |
Install screen, then run vmail. |
Mail is forwarded to delete |
delete was in the wrong position. |
Run /go/forward <email> "" <domain> delete. |
| Forwarded mail is rejected or goes to spam at the other provider | The other provider checks the original sender's SPF, which a forwarding server often fails. | Check your SPF, DKIM, and DMARC records. |
| Mail bounces back and forth | Two addresses forward to each other. | Remove one of the forwards. |
The address contains a quote (') and the change fails |
The address is put into the database command as it is. | Avoid quotes in addresses. |
Details
What it does
- Records the call in
/var/log/go/forward.log. With no arguments, it stops with status1. - Removing (fourth argument is
delete):- Deletes lines that start with the address followed by a space from
/etc/postfix/custom_replies. - Clears
ForwardTofor that address in theMailtable of/var/lib/sqlite/mail.db. - Prints the confirmation.
- Deletes lines that start with the address followed by a space from
- Setting (anything else), only when the address contains
@:- Sets
ForwardTofor that address in theMailtable. - Prints the confirmation.
- Sets
- Starts
vmailin a detachedscreensession, in every case, including when nothing was changed.
flowchart TD
A["forward email forward-to domain action"] --> B{"Any arguments?"}
B -- "No" --> X["Exit 1"]
B -- "Yes" --> C{"Fourth argument is delete?"}
C -- "Yes" --> D["Remove line from custom_replies, clear ForwardTo"]
C -- "No" --> E{"Email contains @?"}
E -- "Yes" --> F["Save ForwardTo in mail.db"]
E -- "No" --> G["Nothing"]
D --> H["Start vmail in the background"]
F --> H
G --> H
Where the setting is stored
| Item | Location |
|---|---|
| The forwarding address | The ForwardTo column of the Mail table in /var/lib/sqlite/mail.db |
| Old custom lines | /etc/postfix/custom_replies, cleaned when you remove forwarding |
| The live mail maps | Rebuilt from the database by vmail |
When you remove forwarding, the address is used as a pattern, so a . in it matches any character. In rare cases a line for a similar address is removed too.
See also
| Command | Description |
|---|---|
forwardemail |
Configure per-domain email forwarding |
vmail |
Rebuild the Postfix/Dovecot vmail maps |
mail |
Create an email address in GoAdmio |
responder |
Create or delete an email autoresponder |
mailpwd |
Bulk-change passwords for all email accounts of a single domain |
copymail |
Copy a domain's mailboxes to the same domain on another GoAdmio server |
spf |
Add or refresh the SPF TXT record via Cloudflare |
dmarc |
Add a DMARC TXT record to a domain's Cloudflare DNS |