<?
func tion my_onBeforeResultAddUpdate($WEB_FORM_ID, $arFields, $arrVALUES)
{
global $APPLICATION, $DB;
if ($WEB_FORM_ID == 7)
{
$resultmail = $DB->Query("SEL ECT ID FR OM b_form_result_answer WH ERE USER_TEXT LIKE '{$arrVALUES['form_email_121']}' AND FORM_ID = 7 AND ANSWER_ID = 121 LIMIT 1", true);
$row2 = $resultmail->Fetch();
if($row2 === false)
{
$mailtext="Ваш 30-ти дневный ключ ".$key;
$arrVALUES['form_hidden_135']=$key;
$Name = "no-reply"; //senders name
$email = "no-reply@vashmail.ru"; //senders e-mail adress
$recipient = $arrVALUES['form_email_121']; //recipient email
$mail_body = "$mailtext"; //mail body
$subject = "Tema"; //subject
$header = "Fr om: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
$mail = mail($recipient, $subject, $mail_body, $header); //mail command :)
}
}
}
AddEventHandler('form', 'onBeforeResultAdd', 'my_onBeforeResultAddUpdate');
?>
|