Delete Email Forwarding Account with xmlapi.php
-
Hello @BillSm, The corresponding cPanel API 2 function to delete a forward is documented at: cPanel API 2 Functions - Email::delforward - Developer Documentation - cPanel Documentation You'll need to update the code to use the email and emaildest parameters for this function. Thank you. 0 -
Also tried with expilicity entering the address and forwarder emails instead of using variables. Same error.
Are you sure the forwarder you attempted to delete exists under the associated cPanel account? Thank you.0 -
Yes, even did a test email and received at the forwarding address. 0 -
Hello, Try deleting the forwarder via the command line to test that it works well. EX: cpapi2 --user=username Email delforward email=user%40example.com emaildest=fwdtome%40example.com
This will help determine if the issue is with your custom script, or with the API function itself. Thank you.0 -
Looking at your command line code, I changed it from: $result_forward = $xmlapi->api2_query($account, 'Email', 'delforward', array(address => $address_to_delete, forwarder => $dest_email) ); To: $result_forward = $xmlapi->api2_query($account, 'Email', 'delforward', array(email => $address_to_delete, emaildest => $dest_email) ); And it deleted correctly. Thanks so much for your help! 0 -
Is there a way to show the status of a process? Like if the deletion or creation was successful or failed? Other than in an error log so I can see the status in the browser and display it? 0 -
Is there a way to show the status of a process? Like if the deletion or creation was successful or failed? Other than in an error log so I can see the status in the browser and display it?
Here are a couple of existing posts you may find helpful: Thank you.0 -
Thanks again! 0 -
If I want to delete a pipe forwarder, is emaildest parameter "|script/path" ? Thanks 0 -
If I want to delete a pipe forwarder, is emaildest parameter "|script/path" ?
Hello @veronicabend, The emaildest parameter should be the path of the script if the destination is a pipe to a program. It needs to be in quotes and encoded. For example, you'd use a command like this if the path was /home/username/public_html/test.php :uapi --user=username Email delete_forwarder address=test5%40domain.com forwarder="%7c%2fhome%2fusername%2fpublic_html%2ftest.php"
The list_forwarders UAPI function is useful if you want to see the specific uri_forward destination to use with the emaildest parameter when deleting a forwarder:uapi --user=username Email list_forwarders domain=domain.com
Thank you.0
Please sign in to leave a comment.
Comments
11 comments