Bitrix Site Manager

CPosting::AutoSend

CPosting::AutoSend(
    int ID = false,
    bool limit = false
);

The method AutoSend schedules the issue sending via the cron or an agent function.

Parameters

ParameterDescription
ID The issue ID. If not specified or false, all issues are sent whose sending time is less or equal to the current.
limit Specifies the maximum count of messages to be sent within a single function call. Used with agents. The default count maximum count of messages is specified in the module settings.

Return Values

No return value.

Example

The following is an example of sending messages via the cron.


#!/usr/bin/php
<?php

// Specify your DOCUMENT_ROOT here!
$_SERVER["DOCUMENT_ROOT"] = "/opt/www/html";

$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
set_time_limit(0);
define("LANG", "en");
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if (CModule::IncludeModule("subscribe"))
{
    $cPosting = new CPosting;
    $cPosting->AutoSend();
}
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");
?>

Example

The following is an example of sending messages via an agent function.


<?
    CAgent::AddAgent("CPosting::AutoSend(".$ID.",true);", 
                     "subscribe", "N", 0, 
                     $post_arr["AUTO_SEND_TIME"], "Y", 
                     $post_arr["AUTO_SEND_TIME"]);
?>
<p class="notetext">Created agent for the message sending.</p>