• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Resolved Bug with XMLApi call to add/remove forwarding ("Unable to activate or deactivate mail group: You should add a mail group member before...")

bago

New Pleskian
Hi, I have a weird issue with XMLApi usage to remotely add/remove email forwarding to users.

I just created my forum account in order to report the issue but I can't post to the report forum, so here I am.

The fact is that a call to enable forwarding sometimes ends up doing the opposite thing and removes the forwarding. You can see the debug for the XML call to enable the forwarding and the weird log about "mailmng-mailname --remove-redirect" instead of "--add-redirect".

This results in the error "Unable to activate or deactivate mail group: You should add a mail group member before enabling the mail group." and my user is not correctly updated.

Sometimes repeating the same API call more times ends up doing the right thing: same XML, bug "mailmng-mailname" call changes.

Sounds like a bug, but as I cannot open a post in report I ask for suggestions about checks/debug I can do and if you think this is a bug, how to escalate it.

[2023-03-11 14:25:14.744] 35230:640c813a8af68 DEBUG [panel] finish()
[2023-03-11 14:25:14.807] 35237:640c813ac52b6 DEBUG [panel] init Agent
[2023-03-11 14:25:14.835] 35237:640c813ac52b6 DEBUG [util_exec] [640c813acbf65] Starting: sys_auth
[2023-03-11 14:25:14.884] 35237:640c813ac52b6 DEBUG [util_exec] [640c813acbf65] Finished in 0.0489s, Error code: TRUE
[2023-03-11 14:25:14.922] 35237:640c813ac52b6 INFO [api-rpc] Incoming API-RPC request [d424924f4f8da6e4cdb1702707059bf4]:
<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>name.surname</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>

[2023-03-11 14:25:14.922] 35237:640c813ac52b6 DEBUG [panel] Protocol version: 1.6.9.1
[2023-03-11 14:25:14.954] 35237:640c813ac52b6 DEBUG [util_exec] [640c813ae8f53] Starting: filwrpr 68
[2023-03-11 14:25:14.966] 35237:640c813ac52b6 DEBUG [util_exec] [640c813ae8f53] Finished in 0.01194s, Error code: TRUE
[2023-03-11 14:25:14.969] 35237:640c813ac52b6 DEBUG [panel] run operator mail
[2023-03-11 14:25:15.021] 35237:640c813ac52b6 DEBUG [util_exec] Starting with task-manager: /usr/local/psa/admin/bin/php -f /usr/local/psa/admin/plib/scripts/interface_async_executor.php -- EventListener /usr/local/psa/admin/pl
ib/modules/log-browser/library/EventListener.php handleEvent admin
[2023-03-11 14:25:15.030] 35237:640c813ac52b6 DEBUG [util_exec] Starting with task-manager: /usr/local/psa/admin/bin/php -f /usr/local/psa/admin/plib/scripts/interface_async_executor.php -- EventListener /usr/local/psa/admin/pl
ib/registry/EventListener/drweb.php handleEvent admin
[2023-03-11 14:25:15.047] 35237:640c813ac52b6 DEBUG [util_exec] [7ab4e312fc64e04d95fd1bbcbc1038a8-0] Starting: mailmng-mailname --remove-redirect --domain-name=mydomain.it --mailname=name.surname --redirect-email=[email protected]
[2023-03-11 14:25:15.077] 35237:640c813ac52b6 DEBUG [util_exec] [7ab4e312fc64e04d95fd1bbcbc1038a8-0] Finished in 0.03023s, Error code: 0
[2023-03-11 14:25:15.090] 35237:640c813ac52b6 INFO [api-rpc] API-RPC response [d424924f4f8da6e4cdb1702707059bf4]:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
<mail>
<update>
<set>
<result>
<status>error</status>
<errcode>1023</errcode>
<errtext>Unable to activate or deactivate mail group: You should add a mail group member before enabling the mail group.</errtext>
<mailname>
<name>name.surname</name>
</mailname>
</result>
</set>
</update>
</mail>
</packet>

[2023-03-11 14:25:15.090] 35237:640c813ac52b6 DEBUG [panel] finish()
 
This sequence always reproduce the issue:

Enable forwarding
curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'

Disable forwarding
curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>false</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'

Try to enable again forwarding fails:
curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'


ERROR:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1"><mail><update><set><result><status>error</status><errcode>1023</errcode><errtext>Unable to activate or deactivate mail group: You should add a mail group member before enabling the mail group.</errtext><mailname><name>nome.cognome</name></mailname></result></set></update></mail></packet>

SAME CALL AGAIN works:

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'


WORKS:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1"><mail><update><set><result><status>ok</status><mailname><name>nome.cognome</name></mailname></result></set></update></mail></packet>
 
Thank you for reporting this issue. I am able to replicate this on my CentOS 7 server as well. I've moved this topic to the reports forum. Hopefully @Peter Debik can forward this report to developers for further investigation.
 
Last edited:
Could you please fill in the form? It is indeed needed for further processing.

PRODUCT/VERSION, OS/ARCHITECTURE

OS version, architecture:

Product version (including MU):

PROBLEM DESCRIPTION

STEPS TO REPRODUCE


[Please enumerate the steps to reproduce in proper formatting, e.g. 1: 2: 3:]
please be as precise as possible!

ACTUAL RESULT

EXPECTED RESULT
 
Sure! I didn't use that format because I was not in the report section, yet ;-)

PRODUCT/VERSION, OS/ARCHITECTURE

OS version, architecture: CentOS Linux 7.9.2009 (Core)

Product version (including MU): Plesk Obsidian v18.0.50_build1800230213.12 os_CentOS 7

PROBLEM DESCRIPTION

Receive an API error "Unable to activate or deactivate mail group: You should add a mail group member before enabling the mail group." while updating an user.

STEPS TO REPRODUCE

1. create a mail user "nome.cognome"
2. enable forwarding via API call:

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'

3. disable forwarding via API call:

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>false</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'
4. enable forwarding via API call:

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>true</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'


ACTUAL RESULT
This last call returns an error and user is not correctly updated:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1"><mail><update><set><result><status>error</status><errcode>1023</errcode><errtext>Unable to activate or deactivate mail group: You should add a mail group member before enabling the mail group.</errtext><mailname><name>nome.cognome</name></mailname></result></set></update></mail></packet>

In the debug log I can see a call to mailmng-mailiname to *remove* the redirect instead of an add/enable redirect:
Starting: mailmng-mailname --remove-redirect --domain-name=mydomain.it --mailname=nome.cognome --redirect-email=[email protected]

EXPECTED RESULT
I expect the user forwarding to be correctly updated.
 
A product issue was confirmed and will now be tracked as ID [PPPM-13933].

Workaround: Run this via CLI
Code:
plesk sbin  mailmng-mailname --add-redirect --domain-name=plesk123.tld --mailname=nome.cognome [email protected]
Run API request again with true.
 
Unfortunately the workaround doesn't work for me as the API user is an external application.
I would need an API based workaround.

Is it about some weird DB status? I could try running some update query in the cron to attempt to prevent the issue, in this case (I know I can investigate this on my own, but my knowledge on plesk internals is very limited).

Is there an URL to track the progress for PPPM-13933?
 
When the issue is fixed, PPPM-13933 will be mentioned in the change log. A better workaround is not available at this time.
 
I identified a workaround for the API workflow by removing the address field from the disable call:
so:

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>false</enabled>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'

instead of

curl -X POST https://myhost:8443/enterprise/control/agent.php \
-H "Content-Type: text/xml" \
-H "Accept: */*" \
-H "HTTP_AUTH_LOGIN: root" \
-H 'HTTP_AUTH_PASSWD: PASS' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<update>
<set>
<filter>
<site-id>2</site-id>
<mailname>
<name>nome.cognome</name>
<forwarding>
<enabled>false</enabled>
<address>[email protected]</address>
</forwarding>
</mailname>
</filter>
</set>
</update>
</mail>
</packet>'

Sounds like this way a following call to enable the redirect will work fine.
 
Fixed in Plesk Obsidian 18.0.52, published April 25th, 2023: Adding or removing mail forwarding via XML API now works.
 
Back
Top