I'm having a problem creating SPAM filters when creating new email users.
I use the following code:
private function addFilters($completeMail, $email) {
$this->cPanel->uapi->Email->add_spam_filter([ "account" => $completeMail ]);
$this->cPanel->uapi->Email->store_filter([
'filtername' => 'SPAM',
'account' => $completeMail,
'action1' => 'save',
'dest1' => '$home/mail/quercus.pt/'.$email.'/.spam',
'part1' => '$h_X-Spam-Status:',
'match1' => 'begins with',
'val1' => 'Yes',
'opt1' => 'or',
'part2' => '$h_X-Spam-Score:',
'match2' => 'is above',
'val2' => '4',
'opt2' => 'or',
'part3' => '$h_X-Spam-Bar:',
'match3' => 'contains',
'val3' => '++++'
]);
}
Assuming $completeMail = [email protected] and $email = teste21:
Thanks in advance.
I use the following code:
private function addFilters($completeMail, $email) {
$this->cPanel->uapi->Email->add_spam_filter([ "account" => $completeMail ]);
$this->cPanel->uapi->Email->store_filter([
'filtername' => 'SPAM',
'account' => $completeMail,
'action1' => 'save',
'dest1' => '$home/mail/quercus.pt/'.$email.'/.spam',
'part1' => '$h_X-Spam-Status:',
'match1' => 'begins with',
'val1' => 'Yes',
'opt1' => 'or',
'part2' => '$h_X-Spam-Score:',
'match2' => 'is above',
'val2' => '4',
'opt2' => 'or',
'part3' => '$h_X-Spam-Bar:',
'match3' => 'contains',
'val3' => '++++'
]);
}
Assuming $completeMail = [email protected] and $email = teste21:
- the .spam folder is not generated
- This is the contents of
cat /home/username/etc/mydomain.com/teste21/filter.yaml
---
filter: []
max_allowed_spam_score: 5
version: '2.2'
Thanks in advance.
Last edited: