Bitrix Site Manager

CPosting::SendMessage

mixed
CPosting::SendMessage(
 int ID, 
 int timeout=0,
 int maxcount = 0
);

The method SendMessage is used to send the issue message to subscribed e-mail addresses.

Messages having the Sent successfully status cannot be sent again. If a message has the Partially sent status set, it is sent to the remaining e-mail addresses.

Parameters

ParameterDescription
ID The issue ID.
timeout Maximum sending period in seconds. In case of timeout, the method terminates and sets the Partially sent status of the message. The parameter is meaningful only for dispatch method Send a message personally. If $timeout=0, the sending operation is not fragmented.
maxcount Maximum number of messages to be sent. If the number of messages sent exceeds this value, the method terminates and sets the issue status Partially sent. This parameter is only meaningful if used with the sending option Send personally to each recipient. If this value is 0, the sending is always performed within a single step.

Return Values

The method returns true on success, or false otherwise. If some of the messages could not be sent, the method returns "CONTINUE". In case of an error, the class variable LAST_ERROR contains the error description.

Example



<?
if ($action=="send" && $ID>0):
    if (($res = $cPosting->SendMessage($ID, 
                COption::GetOptionString("subscribe", 
                                         "posting_interval"))) !== false):
    if($res === "CONTINUE"):
?>		
<script language="JavaScript" type="text/javascript">
<!--
function DoNext()
{
    window.location="<?echo $APPLICATION->GetCurPage().
                    "?ID=".$ID."&action=send&lang=".LANG.
                    "&rnd=".rand();?>";
}
setTimeout('DoNext()', 2500);
//-->
</script>
<?
        else:
            $strOk = "Sent successfully.";
        endif; //$res === "CONTINUE"
    endif; //$cPosting->SendMessage
    $strError .= $cPosting->LAST_ERROR;
endif; //$action=="send"