ePUAP_SendMessageInDeliveryMode
ePUAP_SendMessageInDeliveryMode() function sends a message in a delivery mode to the address of the selected ePUAP user. The delivery mode means that the receiver cannot get the message until the special confirmation (UPD) is signed and sent back to the sender.
Syntax
ePUAP_SendMessageInDeliveryMode(userName, receiverAddress, responseAddress, messageToSend); ePUAP_SendMessageInDeliveryMode(userName, receiverAddress, responseAddress, messageToSend, options);
Function arguments
- userName – (String) a user name (login) of the ePUAP user (an owner of the mailbox on behalf of whom the message is sent);
- receiverAddress – (String) an address of the receiver’s ePUAP mailbox where the message will be sent to;
- responseAddress – (String) an address of the ePUAP mailbox where the reciever can reply to for the message;
- messageToSend – (File) a content of the message to be sent. The content should contain a specially prepared XML file compatible with one of the templates approved by ePUAP. The file can be selected by passing a content of document-type field directly, a field name, a name or even ID of the attachment as well.
Return value
This function returns Object.
ePUAP_SendMessageInDeliveryMode() returns a JSON object with the following properties:
- ’Status’ (only allowed values are 'OK’ and 'Error’),
- ’Description’ (an error description),
- ’MessageId’ (an id of message generated by ePUAP),
- ’DeliveryId’ (an id of delivery generated by ePUAP),
- ’StatusCode’ (a status code of the sending procedure)
- ’StatusDesc’ (a status description of the sending procedure).
Examples
Example 1:
It will send a new message with the content from the field 'DocumentWithMessage’ to the address '/jankowalski/default’ on behalf of the user named 'amoditoffice’. The receiver of the message will get '/amoditoffice/mainMailbox’ as a reply-to (response) address. Setting options allow to select a custom UPD confirmation (the file is taken from the field 'UPD’), generate message ID and thread ID (using rule function CreateGUID() to generate pseudo-random value) and even pick preferable delivery time (the time is taken from the field 'deliveryTime’).
options.deliveryTime = [deliveryTime]; options.deliveryConfirmationFileContent = [UPD]; options.messageId = "amodit" + CreateGUID() + "@epuap.gov.pl"; options.threadId = "amodit" + CreateGUID() + "@epuap.gov.pl"; res = ePUAP_SendMessageInDeliveryMode("amoditoffice", "/jankowalski/default", "/amoditoffice/mainMailbox",[DocumentWithMessage], options);