• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

API :: Enable SpamAssassin for Email account

B

bmwbill42

Guest
Hello.. I have created the following function to enable the spam filter for an account:

function EnableSpam($Username, $DomainName)
{
$req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?><packet version=\"1.3.4.1\"><spamfilter><set><filter><username>$Username@$DomainName</username></filter><enabled/></set></spamfilter>";
return $this->sendCommand($req);
}

$spam = rpc->EnableSpam(test,test.local);

print_r($spam);

The results of the function are:

Array ( [PACKET] => [SYSTEM] => [STATUS] => error [ERRCODE] => 1014 [ERRTEXT] => Parser error: Cannot parse the XML from the source specified )

After searching through the Plesk 8.4 API documentation I can't seem to find the correct way to enable the SpamAssassin feature on a selected mail account...

Can anyone tell me what I'm doing wrong, it has to be with the XML request format.
 
From the look of the code you haven't closed off the packet node. Also, I believe the version should be at least 1.4.2.0? And the username shouldn't have a domain name...
Code:
<packet version=1.4.2.0>
  <spamfilter>
    <set>
      <filter>
        <username>$Username</username>
      </filter>
      <preferences/>
      <enabled/>
    </set>
  </spamfilter>
</packet>
This from the API-rpc 8.4 guide. Hope it helps.
 
Thanks for pointing that out -- I did forget to close the <packet> node.

with and without the $DomainName appended it succeeds with STATUS => OK, but when I check the account through the GUI the Spam Filter is not enabled for the account...

What am I missing? And if its executing the command with STATUS => OK why is the spam filter not being enabled?
 
Also if I change the packet version all I get are parse errors.. I'm running Plesk 8.4 on CentOS. Do I need to update the API component? Is that updated separately of Plesk itself?
 
Back
Top