Author Topic: Add email account error  (Read 4256 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Add email account error
« on: March 09, 2021, 07:22:29 AM »
Hello,

I'm trying to add an email account with an api call. All fields are filled in correctly but i keep getting the same error.

string(101) "{"status":"Error","result":"Error writing to BD","code":"Field 'phone' doesn't have a default value"}"

My api call:

$key = $session->get('cwp_key');
$ip = $session->get('cwp_ip');

$data = array('key' => $key, 'action'=>'add', 'user'=> $_GET['id'], 'email'=>'example', 'domain'=>'example.com', 'pass'=>'eJ0qPsGZdadsfe', 'quotamail'=>'50');

    $url = "https://" . $ip . ":2304/v1/email";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt ($ch, CURLOPT_POST, 1);
    $response = curl_exec($ch);
    curl_close($ch);
    var_dump($response);

Offline
*
Re: Add email account error
« Reply #1 on: March 26, 2021, 07:33:31 AM »
Have you got solution? I am facing same issue while adding email using CWP api.

Offline
*
Re: Add email account error
« Reply #2 on: March 26, 2021, 10:42:59 AM »
I don't know if this is the right solution, but for now it works. I changed phone and email_other in the database to a default value of 0. Maybe if CWP updates the database will change and delete this default values...

https://ibb.co/myDxrtY