Documentation

SendError

SendError(
 string text,
 string module_id = ""
);

Sends error message via e-mail.

For the function to work, ERROR_EMAIL constant must be defined prior to calling it. This constant contains an e-mail address to forward error messages to. If this constant is not defined, the function does nothing. If required, ERROR_EMAIL constant is defined at the start of the current page or in one of the following files:

  • /bitrix/php_interface/dbconn.php
  • /bitrix/php_interface/ID сайта/init.php

In addition to the error text, the e-mail message will include:

  • HTTP_GET_VARS - array of variables, passed to the page via GET-type HTTP query
  • HTTP_POST_VARS - array of variables, passed to the page via POST-type HTTP query
  • HTTP_COOKIE_VARS - array of client variables, stored at local PC (cookies)
  • HTTP_SERVER_VARS - array of standard server variables

This function is called in case of an error in the following functions:

Function parameters

ParameterDescription
text Message text.
module_id The ID of the module, that saves the message.
Optional parameters, "" by default.

Examples of use

<?
// file /bitrix/php_interface/dbconn.php

// define the ERROR_EMAIL constant, with the specified Administrator e-mail
define("ERROR_EMAIL", "admin@site.com");
?>
<?
SendError("Random text message");
?>


© «Bitrix24», 2001-2024