The CreateMessage service allows you to create a new message within Flexmail. The ID of the newly created message will be returned to you.
SOAP Action: CreateMessage
SOAP Return Object: CreateMessageResp
The following table describes the parameters used for calling the CreateMessage service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
messageType | Y | MessageType | Message type |
The following table describes the parameters returned from the CreateMessage service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | / | APIResponseHeader | Header containing authentication information |
errorCode | / | Integer | Numerical value of the error |
errorMessage | / | String | Short literal description of the error |
messageId | / | Integer | Id of the new message |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Message name is mandatory |
222 | Message text is mandatory |
223 | Message name already exists |
224 | Internal error |
This example shows you the creation of a new message withing Flexmail, the name of our message is "my new message" and the text contains the actual HTML code which makes up the message.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $createMessageReq->header = $header; $createMessageReq->messageType->messageName = "my new message" ; $createMessageReq->messageType->messageText = urlencode("<html>…</html>"); $createMessageResp = $SoapClient->__soapCall("CreateMessage",array($createMessageReq)); if ($createMessageResp->errorCode == 0) { echo "Message created, the new mailng list id=" . $createMessageResp->messageId; } else { echo "Message creation failed: " . $createMessageResp->errorMessage; } ?>