$admin_email = trim($_POST["admin_email"]); $form_subject = trim($_POST["form_subject"]); foreach ($_POST as $key => $value) { if ($value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject") { $message .= "\n\t\t\t" . (($c = !$c) ? '<tr>' : '<tr style="background-color: #f8f8f8;">') . "\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'><b>{$key}</b></td>\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'>{$value}</td>\n\t\t</tr>\n\t\t"; } } } else { if ($method === 'GET') { $client_name = trim($_GET["name"]); $client_mail = trim($_GET["email"]); $project_name = trim($_GET["project_name"]); $admin_email = trim($_GET["admin_email"]); $form_subject = trim($_GET["form_subject"]); foreach ($_GET as $key => $value) { if ($value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject") { $message .= "\n\t\t\t" . (($c = !$c) ? '<tr>' : '<tr style="background-color: #f8f8f8;">') . "\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'><b>{$key}</b></td>\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'>{$value}</td>\n\t\t</tr>\n\t\t"; } } } } $message = "<table style='width: 100%;'>{$message}</table>"; function adopt($text) { return '=?UTF-8?B?' . base64_encode($text) . '?='; } $headers = "MIME-Version: 1.0" . PHP_EOL . "Content-Type: text/html; charset=utf-8" . PHP_EOL . 'From: ' . adopt($project_name) . ' <' . $admin_email . '>' . PHP_EOL . 'Reply-To: ' . $admin_email . '' . PHP_EOL; mail("stokpol@mail.ru, savenko.natalia@mail.ru, sale@ferretdream.ru", adopt($form_subject), $message, $headers); $client_message = "<p style='margin-bottom: 1em;'>Добрый день, {$client_name}.</p>\n<p style='margin-bottom: 2em;'>Благодарим Вас за то, что Вы выбрали нас.</p>\n<p style='margin-bottom: 1em;'>Ваш заказ находится в обработке.</p>\n<p style='margin-bottom: 2em;'>В ближайшее время наш менеджер свяжется с Вами, чтобы уточнить подробности заказа.</p>\n<p style='margin-bottom: 2em;'>С уважением, Олег</p>\n<p style='margin-bottom: 1em;'>Почта: <a href='mailto:sale@ferretdream.ru' target='_blank'>sale@ferretdream.ru</a></p>\n<p style='margin-bottom: 1em;'>Сайт: <a href='http://ferretdream.ru' target='_blank'>ferretdream.ru</a></p>\n<p style='margin-bottom: 2em;'>Тел: +7 (903) 005 76 90</p>\n<p><a href='http://ferretdream.ru' target='_blank'><img border='0' width='300' height='94' alt='FerretDream - товары для хорьков' src='http://ferretdream.ru/images/old-logo.png'></a></p>"; mail($client_mail, adopt($form_subject), $client_message, $headers);
//Script Foreach $c = true; if ($method === 'POST') { $project_name = trim($_POST["project_name"]); $admin_email = trim($_POST["admin_email"]); $form_subject = trim($_POST["form_subject"]); foreach ($_POST as $key => $value) { if ($value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject") { $message .= "\n\t\t\t" . (($c = !$c) ? '<tr>' : '<tr style="background-color: #f8f8f8;">') . "\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'><b>{$key}</b></td>\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'>{$value}</td>\n\t\t</tr>\n\t\t"; } } } else { if ($method === 'GET') { $project_name = trim($_GET["project_name"]); $admin_email = trim($_GET["admin_email"]); $form_subject = trim($_GET["form_subject"]); foreach ($_GET as $key => $value) { if ($value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject") { $message .= "\n\t\t\t" . (($c = !$c) ? '<tr>' : '<tr style="background-color: #f8f8f8;">') . "\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'><b>{$key}</b></td>\n\t\t\t<td style='padding: 10px; border: #e9e9e9 1px solid;'>{$value}</td>\n\t\t</tr>\n\t\t"; } } } } $message = "<table style='width: 100%;'>{$message}</table>"; function adopt($text) { return '=?UTF-8?B?' . Base64_encode($text) . '?='; } $headers = "MIME-Version: 1.0" . PHP_EOL . "Content-Type: text/html; charset=utf-8" . PHP_EOL . 'From: ' . adopt($project_name) . ' <' . $admin_email . '>' . PHP_EOL . 'Reply-To: ' . $admin_email . '' . PHP_EOL; mail($admin_email, adopt($form_subject), $message, $headers);