Skip to content

Commit 4cf1404

Browse files
authored
Merge pull request #3 from jtx/mail_forwarding
Change mail to use forwarders instead of creating accounts
2 parents 974d4b7 + d6f0c88 commit 4cf1404

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/PleskX/Api/Operator/Mail.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
class Mail extends \PleskX\Api\Operator
88
{
9-
109
/**
1110
* @param string $name
12-
* @param integer $siteId
13-
* @param boolean $mailbox
14-
* @param string $password
11+
* @param int $siteId
12+
* @param string $forwardAddress
1513
* @return Struct\Info
1614
*/
17-
public function create($name, $siteId, $mailbox = false, $password = '')
15+
public function create(string $name, int $siteId, string $forwardAddress)
1816
{
1917
$packet = $this->_client->getPacket();
2018
$info = $packet->addChild($this->_wrapperTag)->addChild('create');
@@ -23,14 +21,13 @@ public function create($name, $siteId, $mailbox = false, $password = '')
2321
$filter->addChild('site-id', $siteId);
2422
$mailname = $filter->addChild('mailname');
2523
$mailname->addChild('name', $name);
26-
if ($mailbox) {
27-
$mailname->addChild('mailbox')->addChild('enabled', 'true');
28-
}
29-
if (!empty($password)) {
30-
$mailname->addChild('password')->addChild('value', $password);
31-
}
24+
25+
$forwarding = $mailname->addChild('forwarding');
26+
$forwarding->addChild('enabled', 'true');
27+
$forwarding->addChild('address', $forwardAddress);
3228

3329
$response = $this->_client->request($packet);
30+
3431
return new Struct\Info($response->mailname);
3532
}
3633

0 commit comments

Comments
 (0)