DenisKarakchiev
9/5/2017 - 2:24 PM

send.php php mailing template #php

send.php php mailing template #php

<?php
if ($_POST['keyasdf32we*7f'] != 'valwreilkjeswo8r349') {
    exit('Spam decected');
}

$email_toComp = '%mail%, %mail%';
$page = $_SERVER['HTTP_REFERER'];
$from = '%sitename%<no-reply@%sitename%>';
$headers = "From: %sitename%<no-reply@%sitename%>";
$headers .= "\nReply-To: <no-reply@%sitename%>";
$headers .= "\nReturn-Path: <no-reply@%sitename%>";
$headers .= "\nDate: " . date('r');
$headers .= "\nX-Mailer: PHP 5.3";
$headers .= "\nContent-type: text/plain; charset=utf-8 \r\n";

function clean($value)
{
    $value = trim($value);
    $value = stripslashes($value);
    $value = strip_tags($value);
    $value = htmlspecialchars($value);
    return $value;
}

$phone = clean($_POST['phone']);
$formType = clean($_POST['formType']);

$subject = 'Заявка с сайта %sitename%';
$message = "Заявка.
Телефон: $phone";
mail($email_toComp, $subject, $message, $headers);

header('Location: spasibo.html');