Introduction
This guide will show you how to add email forwarders using UAPI in the command line.
Procedure
This is an example of the command for adding a email forwarder to a domain:
uapi --user=cptest Email add_forwarder domain=cptest.tld email=user@cptest.tld fwdopt=fwd fwdemail=fwdtome@example.com
Be sure to change the user, domain, email, and fwdemail variables to that of your user, their domain, the email address that will be doing the forwarding, and the email address that mail is being forwarded to, respectively.
Here is an example of the output of this command:
[ root@184.94.197.2 [] ~]# uapi --user=cptest Email add_forwarder domain=cptest.tld email=user@cptest.tld fwdopt=fwd fwdemail=fwdtome@example.com
---
apiversion: 3
func: add_forwarder
module: Email
result:
data:
-
domain: cptest.tld
email: user@cptest.tld
forward: fwdtome@example.com
errors: ~
messages: ~
metadata:
transformed: 1
status: 1
warnings: ~
Our documentation on this UAPI function can be found below:
https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Aadd_forwarder