Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

Commit

Permalink
Added default spam profile of Normal when creating mail domain.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwispy committed Mar 5, 2020
1 parent 01d4637 commit 1855702
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
23 changes: 23 additions & 0 deletions classes/ispcfg3_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,29 @@ public function mail_user_update( $client_id, $primary_id, array $params = null
return $result;
}

public function mail_spamfilter_user_add( $client_id, $params = null ) {
if ( !is_array( $client_id ) ) {
$data = [ 'client_id' => $client_id ];
$data['params'] = $params;
} else {
$data = $client_id;
}
$result = self::restpost( 'mail_spamfilter_user_add', $data );

return $result;
}

public function mail_policy_get( $primary_id ) {
if ( !is_array( $primary_id ) ) {
$data = [ 'primary_id' => $primary_id ];
} else {
$data = $primary_id;
}
$result = self::restpost( 'mail_policy_get', $data );

return $result;
}

public function mailquota_get_by_user( $primary_id ) {
if ( !is_array( $primary_id ) ) {
$data = [ 'primary_id' => $primary_id ];
Expand Down
14 changes: 14 additions & 0 deletions ispcfg3.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,20 @@ function ispcfg3_CreateAccount(array $params ) {

logModuleCall('ispconfig','CreateMailDomain',$maildomain_id['response'],$ispcparams,'','');

$policy = $client->mail_policy_get( array( 'primary_id' => array( 'policy_name' => 'Normal' ) ) );

$ispcparams = array(
'server_id' => $defaultmailserver,
'priority' => 5,
'policy_id' => $policy['response'][0]['id'],
'email' => '@'.$domain,
'fullname' => '@'.$domain,
'local' => 'y'
);

$mailpolicy_id = $client->mail_spamfilter_user_add( $client_id, $ispcparams );

logModuleCall('ispconfig','CreateMailPolicy',$mailpolicy_id['response'],$ispcparams,'','');
}

if ( $dbcreate == 'on' ) {
Expand Down

0 comments on commit 1855702

Please sign in to comment.