Create email account forwarder

This function creates an email forwarder.

Important:

In cPanel & WHM version 76 and later, when you disable the MailReceive role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Authorizations:
query Parameters
domain
required
string

The domain.

Example: domain=example.com
email
required
string

The email address to forward.

Example: email=forwardme@example.com
fwdopt
required
string

The method to use to handle the email address's mail.

Example: fwdopt=fwd
failmsgs
string
Default: "No such person at this address"

The failure message for the message's sender.

Note:

Use this parameter if you used the fail method for the fwdopt parameter.

Example: failmsgs=Nobody home.
fwdemail
string

The email address to which the system forwards messages.

Note:

You must use this parameter if you used the fwd method for the fwdopt parameter. You can pass multiple addresses to this parameter as a comma-separated list.

Example: fwdemail=fwdtome@example.com
fwdsystem
string

The system user to whom the system forwards messages.

Note:

You must use this parameter if you used the system method for the fwdopt parameter.

Example: fwdsystem=user
pipefwd
string

The application to which the system pipes messages.

Note:

You must use this parameter if you used the pipe method for the fwdopt parameter.

Important:

In cPanel & WHM version 86 and later, this parameter requires the FileStorage role. For more information, read our How to Use Server Profiles documentation.

Example: pipefwd=mailscript.pl

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  Email \
  add_forwarder \
  domain='example.com' \
  email='forwardme@example.com' \
  fwdopt='fwd'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "add_forwarder",
  • "module": "Email",
  • "result": {
    • "data": [
      • {
        • "domain": "example.com",
        • "email": "user@example.com",
        • "forward": "fwdtome@example.com"
        }
      ],
    • "errors": null,
    • "messages": null,
    • "metadata": {
      • "transformed": 1
      },
    • "status": 1,
    • "warnings": null
    }
}