Mail alias import through Remote API - problem

Discussion in 'General' started by Piotr Perkowski, Apr 17, 2020.

  1. Piotr Perkowski

    Piotr Perkowski New Member

    I'm trying to import email users using remote API but it doesn't work.
    Here's part of code that I use to import aliases
    $alias_params = array(
                            'server_id' => '1',
                            'source' => $al[0],
                            'destination' => rtrim($al[1]),
                            'type' => 'alias',
                            'active' => 'y',
                            'sys_userid' => $al[2],
                            'sys_groupid' => $al[3]
                    try {
                        echo "source: $al[0] <br> destination: $al[1] $al[2] $al[3]<br>";
                        $alias_id = $client->mail_alias_add($session_id,9,$alias_params);
                        echo "Alias $mb[0] for $mb[1] created<br>";
                    } catch (SoapFault $e){
                        die ('Alias creation error: '.$e->getMessage());
    It's the only part of script that's not working.
    When I run script it gives me following error:
    Adding aliases through web UI works fine, but I have several hundreds of accounts to import and it would help if I could automate it in some way.
    Does someone have any workaround this problem?
    ISPConfig version 3.1.15p3

    Thank you for any help. :)
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Seems as if you try to assign a record to a nonexisting client. Check that you really have a client in the database table 'client' where client_id = 9
    Piotr Perkowski likes this.
  3. Piotr Perkowski

    Piotr Perkowski New Member

    You were right.
    Probably it got copied from test server and wasn't spotted :)
    Thank you for fast help

    Piotr Perkowski
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

Share This Page