<?php

    require_once "../config.php";
    require_once GLOBAL_INCLUDE_PATH."include/startup.php";
    
    require_once(GLOBAL_INCLUDE_PATH."include/email/sendEmail.php");
    $Validation = new Validation();
    
    $name = $_POST['name'];
    $company = $_POST['company'];
    $contact = $_POST['contact'];
    $email = $_POST['email'];

    $valid = "";
    $valid .= $Validation->check_blank("name", $name, "Name");
    $valid .= $Validation->check_blank("company", $company, "Company");
    $valid .= $Validation->check_blank("contact", $contact, "Contact");
    $valid .= $Validation->check_blank("email", $email, "Email");

    if($valid){
        echo "1|".$valid;
    }else{
        
        $from_email = $email; 
        $from_name  = $name;
		$to_name    = "site admin"; 
        $to_email   = "akashacer1996@gmail.com"; 
        
        $subject    = "anutecingredients - Exhibition List 2018 Form Download"; 
        		
        $emailMsg .= "Name : $name <br>";
        $emailMsg .= "Company : $company <br>";
        $emailMsg .= "Contact : $contact <br>";
        $emailMsg .= "Email : $email <br>";
				
        $html_message = $emailMsg;
        
        $attachment   = "";
        
        $retmsg = sendmail ($from_name, $from_email, $to_name, $to_email, $subject, $text_message, $html_message, $attachment); 
        
        if($retmsg){
            echo "0|Message Sent to admin !";
        }else{
            echo "1|Something Wrong";
        }
    }