Skip to content

Instantly share code, notes, and snippets.

@vgrish
Created September 5, 2013 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrish/6447314 to your computer and use it in GitHub Desktop.
Save vgrish/6447314 to your computer and use it in GitHub Desktop.
<?php
$uri = $_SERVER['REDIRECT_URL'];
$ref = $_SERVER['HTTP_REFERER'];
$confirmationFields['uri'] = $uri;
$confirmationFields['ref'] = $ref;
$uri.="\n";
$file=fopen("uri.txt", "a");
fwrite ($file,"http://".$_SERVER['SERVER_NAME'].$uri);
fclose($file);
$message = $modx->getChunk('tpl.redirect', $confirmationFields);
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,'me@example.org');
$modx->mail->set(modMail::MAIL_FROM_NAME,'Сайт name.ru');
$modx->mail->set(modMail::MAIL_SUBJECT,'неправильный адрес');
$modx->mail->address('to','vovanblya@mail.ru');
$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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment