собственно сам код

$tpl = $modx->getOption('fiarTpl',$scriptProperties,'fiDefaultFiarTpl');
$mailFrom = $modx->getOption('fiarFrom',$scriptProperties,$modx->getOption('emailsender'));
$mailFromName = $modx->getOption('fiarFromName',$scriptProperties,$modx->getOption('site_name'));
$mailSender = $modx->getOption('fiarSender',$scriptProperties,$modx->getOption('emailsender'));
$mailSubject = $modx->getOption('fiarSubject',$scriptProperties,' vayar34755@provamail.com');
$mailSubject = str_replace(array('',''),array($modx->getOption('site_name'),$modx->getOption('emailsender')),$mailSubject);
$fiarFiles = $modx->getOption('fiarFiles',$scriptProperties,false);
$isHtml = $modx->getOption('fiarHtml',$scriptProperties,true);
$toField = $modx->getOption('fiarToField',$scriptProperties,'vayar34755@provamail.com');
$multiSeparator = $modx->getOption('fiarMultiSeparator',$formit->config,"\n");
$multiWrapper = $modx->getOption('fiarMultiWrapper',$formit->config,"");
$required = $modx->getOption('fiarRequired',$scriptProperties,true);
if (empty($fields[$toField])) {
if ($required) {
$modx->log(modX::LOG_LEVEL_ERROR,'[FormIt] Auto-responder could not find field `'.$toField.'` in form submission.');
return false;
} else {
return true;
}
}

/* handle checkbox and array fields */
foreach ($fields as $k => $v) {
if (is_array($v) && !empty($v['name']) && isset($v['error']) && $v['error'] == UPLOAD_ERR_OK) {
$fields[$k] = $v['name'];
} elseif (is_array($v)) {
$vOpts = array();
foreach ($v as $vKey => $vValue) {
if (is_string($vKey) && !empty($vKey)) {
$vKey = $k.'.'.$vKey;
$fields[$vKey] = $vValue;
} else {
$vOpts[] = str_replace('', $vValue, $multiWrapper);
}
}
$newValue = implode($multiSeparator, $vOpts);
if (!empty($vOpts)) {
$fields[$k] = $newValue;
}
}
}

/* setup placeholders */
$placeholders = $fields;
$mailTo= $fields[$toField];

$message = $formit->getChunk($tpl,$placeholders);
$modx->parser->processElementTags('',$message,true,false);

$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->reset();
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,$hook->_process($mailFrom,$placeholders));
$modx->mail->set(modMail::MAIL_FROM_NAME,$hook->_process($mailFromName,$placeholders));
$modx->mail->set(modMail::MAIL_SENDER,$hook->_process($mailSender,$placeholders));
$modx->mail->set(modMail::MAIL_SUBJECT,$hook->_process($mailSubject,$placeholders));
$modx->mail->address('to',$mailTo);
$modx->mail->setHTML($isHtml); ф