<?php
//var_dump($_POST); die();
// Check for empty fields
if(empty($_POST['rsocial'])      ||
   empty($_POST['email'])     ||
   empty($_POST['telefono'])     ||
   empty($_POST['cuit'])   ||
   empty($_POST['provincia'])   ||
   empty($_POST['localidad'])   ||
   empty($_POST['domicilio_fiscal'])   ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
   echo "No arguments Provided!";
   return false;
   }
   
$rsocial = strip_tags(htmlspecialchars($_POST['rsocial']));
$email_address = strip_tags(htmlspecialchars($_POST['email']));
$telefono = strip_tags(htmlspecialchars($_POST['telefono']));
$cuit = strip_tags(htmlspecialchars($_POST['cuit']));
$provincia = strip_tags(htmlspecialchars($_POST['provincia']));
$localidad = strip_tags(htmlspecialchars($_POST['localidad']));
$domicilio_fiscal = strip_tags(htmlspecialchars($_POST['domicilio_fiscal']));

//var_dump($rsocial.'-'.$email_address.'-'.$telefono.'-'.$cuit.'-'.$provincia.'-'.$localidad.'-'.$domicilio_fiscal); die();
// Create the email and send the message
$to = 'aegirsys@aegirsystem.com'; // Add your email address inbetween the '' replacing aegirsys@aegirsystem.com - This is where the form will send a message t
$email_subject = "Formulario de registro:  $rsocial";
$email_body = "Has recibido un nuevo registro de usuario.\n\n"."Detalles:\n\nRazón social: $rsocial\n\nEmail: $email_address\n\ntelefono: $telefono\n\nCUIT: $cuit"."\n\nProvincia: $provincia\n\nLocalidad: $localidad\n\nDomicilio Fiscal: $domicilio_fiscal";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";   
mail($to,$email_subject,$email_body,$headers);
return true;         
?>
