• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue My Mail API Script is not working for creating mail accounts.

I had working script written in PHP to create email account in plesk. I got that from
pmill/php-plesk

Script is below.
<?php

require_once("config.php");
//echo $_GET['r']."<br>";
$emilid=$_GET['email'];
$password=$_GET['password'];

$params = array(
'email'=>$emilid,
'password'=>$password,
);

$request = new \pmill\Plesk\CreateEmailAddress($config, $params);
$info = $request->process();

Now. This script does not work after my plesk was update to Version 17.8.11.

My Server details are
OS ‪CentOS Linux 7.5.1804 (Core)‬
Product Plesk Onyx
Version 17.8.11 Update #22, last updated on Sept 26, 2018 03:25 AM


Please help me how to fix this.
 
mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'pmill\\Plesk\\ApiRequestException' with message 'Error: Incorrect request parameters submitted' in /var/www/vhosts/../plesk/src/pmill/Plesk/BaseRequest.php:31, referer: https://../system-emailgateway-vcm-emails-new.php?id=88

mod_fcgid: stderr: Stack trace:, referer: https://../system-emailgateway-vcm-emails-new.php?id=88

mod_fcgid: stderr: #0 /var/www/vhosts/../plesk/src/pmill/Plesk/ListEmailAddresses.php(33): pmill\\Plesk\\BaseRequest->__construct(Array, Array), referer: https://../system-emailgateway-vcm-emails-new.php?id=88

mod_fcgid: stderr: #1 /var/www/vhosts/../plesk/examples/EmailAddresses/checkemail.php(8): pmill\\Plesk\\ListEmailAddresses->__construct(Array, Array), referer: https://../system-emailgateway-vcm-emails-new.php?id=88

mod_fcgid: stderr: #2 {main}, referer: https://../system-emailgateway-vcm-emails-new.php?id=88

mod_fcgid: stderr: thrown in /var/www/vhosts/../plesk/src/pmill/Plesk/BaseRequest.php on line 31, referer: https://../system-emailgateway-vcm-emails-new.php?id=88
 
What Plesk version did you update from? Just curious as this github project hasn't been updated in a few years by the looks of it.
 
Line 31 is
if (!$this->check_params()) {
throw new ApiRequestException("Error: Incorrect request parameters submitted");
}

I commented the line as
//throw new ApiRequestException("Error: Incorrect request parameters submitted");

Now
This error comes.

mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'pmill\\Plesk\\ApiRequestException' with message 'This feature is not supported for protocol version 1.6.3.5.' in /var/www/vhosts/../plesk/src/pmill/Plesk/CreateEmailAddress.php:60, referer: https://../system-emailgateway-vcm-emails-new.php?id=88

My Latest version is
Plesk Onyx
Version 17.8.11 Update #24, last updated on Oct 4, 2018 03:10 AM

It's just automate update. It comes and I says update.
 
Can't I change the version of API. It's not my fault, it's automated update.

If I cannot change the version, can you give me code samples. this documentation does not have a sample. It seems complex.
 
To confirm, you’re just looking for a quick example in PHP to make a proper API called to Plesk to create an email account?

I can get you something in a day or two if nobody beats me to it. I’m just too busy with other clients lately. I also haven’t worked with the Plesk API lately so I’m thinking my current examples wouldn’t function either.
 
Back
Top