switch ($modx->event->name) {
case 'OnUserSave':
$actFullname = $_POST['fullname'];
$actEmail = $_POST['email'];
if(!empty($actEmail)) {
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_FROM, $modx->getOption('noreply@server.com'));
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption('manager'));
$modx->mail->address('to', 'admin@mail.com');
$modx->mail->address('reply-to','noreply@server.com');
$modx->mail->set(modMail::MAIL_SUBJECT, 'New User Registred');
$message = "name: $actFullname <br>" .
"mail: $actEmail <br>";
$modx->mail->set(modMail::MAIL_BODY, $message);
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
}
$modx->mail->reset();
}
break;
}
}
Спасибо!
Обсуждают сегодня