add_mailforward()

Create a mail forward.

All API functions Email Forwarding

Signature

add_mailforward(array $parameters): mixed

Parameters

Pass these parameters as KasRequestParams. Every request also requires kas_login, kas_auth_type, and kas_auth_data, as shown in SOAP with PHP.

Name Description Requirement
local_part The local part, RFC 2822 Required
domain_part FQDN, RFC 2822 Required
target_N The forwarding targets, RFC 2822; N is a sequential number Optional

PHP example

<?php

// $sessionToken is returned by KasAuth, see SOAP with PHP.
$parameters = [
    'local_part' => 'forward',
    'domain_part' => 'example.com',
    'target_0' => 'target0@example.com',
    'target_1' => 'target1@example.com',
    'target_2' => 'target2@example.com',
    'target_3' => 'target3@example.com',
    'target_4' => 'target4@example.com',
    'target_5' => 'target5@example.com',
    'target_6' => 'target6@example.com',
    'target_7' => 'target7@example.com',
    'target_8' => 'target8@example.com',
    'target_9' => 'target9@example.com',
];

try {
    $client = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
    $response = $client->KasApi(json_encode([
        'kas_login' => 'w0123456',
        'kas_auth_type' => 'session',
        'kas_auth_data' => $sessionToken,
        'kas_action' => 'add_mailforward',
        'KasRequestParams' => $parameters,
    ]));
    print_r($response);
} catch (SoapFault $fault) {
    echo 'Error: ' . $fault->faultstring;
}

Responses and error codes

  • TRUE the action was carried out
  • missing_parameter a required parameter is missing
  • couldnt_get_kas_ressources
  • domain_part_doesnt_exist
  • hostname_syntax_incorrect
  • mail_forward_adress_syntax_incorrect
  • mail_forward_exists_as_emailaccount
  • mail_forward_exists_as_forward
  • max_mail_forward_reached
  • target_email_duplicate
  • mail_loop_detected
  • target_email_like_forward
  • target_email_syntax_incorrect
  • targets_limit_reached