6
6
7
7
class Mail extends \PleskX \Api \Operator
8
8
{
9
-
10
9
/**
11
10
* @param string $name
12
- * @param integer $siteId
13
- * @param boolean $mailbox
14
- * @param string $password
11
+ * @param int $siteId
12
+ * @param string $forwardAddress
15
13
* @return Struct\Info
16
14
*/
17
- public function create ($ name , $ siteId , $ mailbox = false , $ password = '' )
15
+ public function create (string $ name , int $ siteId , string $ forwardAddress )
18
16
{
19
17
$ packet = $ this ->_client ->getPacket ();
20
18
$ info = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('create ' );
@@ -23,14 +21,13 @@ public function create($name, $siteId, $mailbox = false, $password = '')
23
21
$ filter ->addChild ('site-id ' , $ siteId );
24
22
$ mailname = $ filter ->addChild ('mailname ' );
25
23
$ 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 );
32
28
33
29
$ response = $ this ->_client ->request ($ packet );
30
+
34
31
return new Struct \Info ($ response ->mailname );
35
32
}
36
33
0 commit comments