<?php
    if ( ($_POST['name']=="") || ($_POST['surname']=="") || ($_POST['company']=="") || ($_POST['mail']=="") || ($_POST['area']==""))
    {
    echo "e-mail was not sent successfully. Try <a href = \"esoxplast.php?ID=kontaktform\">again</a>";
    }
    else
    {
    
    $headers  = "From: ".$_POST['mail']."\r\n";
    $headers .= "Reply-To: ".$_POST['mail']."\r\n";
    $headers .= "Return-Path: ".$_POST['mail']."\r\n";
    $headers .= 'X-Mailer: php/'.phpversion()."\r\n";
    $headers .= 'MIME-Version: 1.0' . "\n";
    $headers .= 'Content-type: text/html; charset=windows-1250' . "\r\n";
    
    $message = $_POST['name']."\r\n";
    $message .= $_POST['surname']."\r\n";
    $message .= $_POST['company']."\r\n\r\n";
    $message .= wordwrap($_POST['area'], 70);
    $message .="\r\n\r\n";
    $message .= $_POST['mail'];
    
    $to = "tekel@esox.sk";
    $subject = "Kontaktny formular od ".$_POST['name'].' '.$_POST['surname'];
    
    if (mail ($to, $subject, $message, $headers))
    {
      header ("location: esoxplast.php?ID=kontaktform");
    }
    else
    {
      echo "e-mail was not sent successfully. Try <a href = \"esoxplast.php?ID=kontaktform\">again</a>";
    }
    }
?>
