You can use this Add Email Forwarder API to Add Email Forwarder your Webuzo panel.
Name | Method | Value | Description | Required |
act | GET | email_forward | The action specified to add email forwader. | Yes |
add | POST | int | This will trigger add email forwader. | Yes |
POST | text | User Name of Email account e.g:- If email is user_test@domain.com you need to pass only user_test | Yes | |
domain | POST | text | Domain of user email account | Yes |
forwarder | POST | email | pipe | sys | fail | discard | Type of Forwader you want to set (email | pipe | sys | fail | discard) | Yes |
femail | POST | Specify the TO Email address. When Forwader type is email | No | |
fail | POST | msg | Specify the fail message. When Forwader type is fail. | No |
pipe_path | POST | text | Specify the pipe_path When Forwader type is pipe. Note: Add path after /home/username/ exmple : /home/user1/folder1/test you need to pass only folder1/test | No |
Curl PHP
You can use the following commands to create different types of forwarders:
1. Create Forwarder To Email Address:
Specify the TO Email address and other required details.
curl --insecure -d "add=1" -d "forwarder=email" -d "domain=domain.com" -d "email=username_of_email_account " -d "femail=specify_the_TO_email_address" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=email_forward"
2. Create Forwarder Fail with message:
Set the 'fail' parameter to the fail message you want to display
curl --insecure -d "add=1" -d "forwarder=fail" -d "domain=domain.com" -d "email=username_of_email_account" -d "fail=fail message" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=email_forward"
3. Create Forwarder To Your System Account:
This type forwards emails to your system account.
curl --insecure -d "add=1" -d "forwarder=sys" -d "domain=domain.com" -d "email=username_of_email_account" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=email_forward"
4. Create Forwarder Pipe to a Program:
Specify the path of the pipe file (e.g. if pipe path is /home/user_name/folder1/pipe_file then you need pass like this folder1/pipe_file ).
curl --insecure -d "add=1" -d "forwarder=pipe" -d "domain=domain.com" -d "email=shakir" -d "pipe_path=public_html/test_folder/test" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=email_forward"
5. Create Forwarder Discard (Not Recommended):
This type discards the forwarded emails.
curl --insecure -d "add=1" -d "forwarder=discard" -d "domain=domain.com" -d "email=shakir" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=email_forward"
Email forwarder successfully created.