diff --git a/app/confg.php b/app/confg.php index 118abde..4409e84 100644 --- a/app/confg.php +++ b/app/confg.php @@ -31,7 +31,7 @@ define('API', 'http://api.argumenti.ru/'); define('IMGSRV', 'https://imgurl.argumenti.ru/'); /** отправка уведомлений */ -set('mail', +set('noreply', [ 'login' => 'noreply@argumenti.ru', 'name' => 'Аргументы Недели', diff --git a/app/index.php b/app/index.php index 69254f3..1ab6c17 100644 --- a/app/index.php +++ b/app/index.php @@ -9,6 +9,7 @@ require 'routes/client.php'; require 'routes/anpdf.php'; require 'routes/auth.php'; require 'routes/pdfserver.php'; +require 'routes/email.php'; #api require 'api/apiclient.php'; diff --git a/app/routes/auth.php b/app/routes/auth.php index f17d00a..2fc9f14 100644 --- a/app/routes/auth.php +++ b/app/routes/auth.php @@ -136,6 +136,19 @@ function reminder_kuri(){ $result = db_insert('resetpwd', $items, 'chitatel'); $link = SITE.'resetpassword/'.$items['resethash']; + $mailconfig = set('noreply'); + + $mail['mail'] = $resetmail; + $mail['subject'] = 'КЛАН: создание пароля'; + $mail['message'] = " + Вы запросили изменения пароля для Вашей учетной записи.\n + Для установления пароля пройдите по ссылке - $link.\n\n + - Не передавайте эту ссылку сторонним лицам\n + - Если Вы не запрашивали это действие просто проигнорируйте данное письмо\n\n + По вопросам обращайтесь на почту shop@argumenti.ru + "; + + sendmail($mailconfig, $mail); $tempcontent = VIEWPATH.'reminder_end.phtml'; include VIEWPATH.'layout_lite.phtml'; //центральный шаблон diff --git a/app/routes/email.php b/app/routes/email.php index 22352e0..1c23d0a 100644 --- a/app/routes/email.php +++ b/app/routes/email.php @@ -7,25 +7,33 @@ function sendmail($config, $mail){ $send = new PHPMailer; $send->isSMTP(); - //$send->SMTPDebug=3; // Set mailer to use SMTP + $send->SMTPDebug=3; // Set mailer to use SMTP $send->Host = $config['host']; // Specify main and backup SMTP servers $send->Username = $config['login']; // SMTP username $send->Password = $config['password']; - if (isset($frommail['secure'])) { - $send->SMTPSecure = $frommail['secure']; + if (isset($config['secure'])) { + $send->SMTPSecure = $config['secure']; $send->SMTPAuth = true; } else { - $mail->SMTPSecure = false; - $mail->SMTPAutoTLS = false; + $send->SMTPSecure = false; + $send->SMTPAutoTLS = false; } $send->Port = $config['port']; // TCP port to connect to - $send->setFrom($config['mail'], $config['name']); - $send->addAddress($mail, $mail); // Add a recipient + $send->setFrom($config['login'], $config['name']); + $send->addAddress($mail['mail'], $mail['mail']); // Add a recipient $send->CharSet = 'UTF-8'; - $send->isHTML(True); // Set email format to HTML + + if (isset($mail['html'])){ + $send->isHTML(True); // Set email format to HTML + } + else { + $send->ContentType = 'text/plain'; + $send->isHTML(False); + } + $send->Subject = $mail['subject']; $send->Body = $mail['message']; diff --git a/app/views/reminder_end.phtml b/app/views/reminder_end.phtml index 7c111c1..7664c12 100644 --- a/app/views/reminder_end.phtml +++ b/app/views/reminder_end.phtml @@ -1,5 +1 @@ -

Ссылка на восстановление пароля выслана на Вашу электронную почту

- - -
Для установки пароля пройдите по ссылке
- \ No newline at end of file +

Ссылка на создание пароля выслана на Вашу электронную почту

\ No newline at end of file