MailAttributes.php
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
namespace AliyunMNS\Model;
use AliyunMNS\Constants;
/**
* Please refer to
* https://docs.aliyun.com/?spm=#/pub/mns/api_reference/intro&intro
* for more details
*/
class MailAttributes
{
public $subject;
public $accountName;
public $addressType;
public $replyToAddress;
public $isHtml;
public function __construct(
$subject, $accountName, $addressType=0, $replyToAddress=false, $isHtml = false)
{
$this->subject = $subject;
$this->accountName = $accountName;
$this->addressType = $addressType;
$this->replyToAddress = $replyToAddress;
$this->isHtml = $isHtml;
}
public function setSubject($subject)
{
$this->subject = $subject;
}
public function getSubject()
{
return $this->subject;
}
public function setAccountName($accountName)
{
$this->accountName = $accountName;
}
public function getAccountName()
{
return $this->accountName;
}
public function setAddressType($addressType)
{
$this->addressType = $addressType;
}
public function getAddressType()
{
return $this->addressType;
}
public function setReplyToAddress($replyToAddress)
{
$this->replyToAddress = $replyToAddress;
}
public function getReplyToAddress()
{
return $this->replyToAddress;
}
public function setIsHtml($isHtml)
{
$this->isHtml = $isHtml;
}
public function getIsHtml()
{
return $this->isHtml;
}
public function writeXML(\XMLWriter $xmlWriter)
{
$jsonArray = array();
if ($this->subject !== NULL)
{
$jsonArray[Constants::SUBJECT] = $this->subject;
}
if ($this->accountName !== NULL)
{
$jsonArray[Constants::ACCOUNT_NAME] = $this->accountName;
}
if ($this->addressType !== NULL)
{
$jsonArray[Constants::ADDRESS_TYPE] = $this->addressType;
}
else
{
$jsonArray[Constants::ADDRESS_TYPE] = 0;
}
if ($this->replyToAddress !== NULL)
{
if ($this->replyToAddress === TRUE)
{
$jsonArray[Constants::REPLY_TO_ADDRESS] = "1";
}
else
{
$jsonArray[Constants::REPLY_TO_ADDRESS] = "0";
}
}
if ($this->isHtml !== NULL)
{
if ($this->isHtml === TRUE)
{
$jsonArray[Constants::IS_HTML] = "1";
}
else
{
$jsonArray[Constants::IS_HTML] = "0";
}
}
if (!empty($jsonArray))
{
$xmlWriter->writeElement(Constants::DIRECT_MAIL, json_encode($jsonArray));
}
}
}
?>