This is my html code:
<form id="main-contact-form" name="contact-form" method="post" action="php/sendemail.php">
<div class="row wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Nombre Completo" required="">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Correo Electronico" required="">
</div>
</div>
</div>
<div class="form-group">
<input type="text" name="phone" class="form-control" placeholder="Numero de telefono" required="">
</div>
<div class="form-group">
<input type="text" name="section" class="form-control" placeholder="Grado & Sección" required="">
</div>
<div class="form-group">
<input type="text" name="subject" class="form-control" placeholder="Subjeto" required="">
</div>
<div class="form-group">
<textarea name="txt" id="message" class="form-control" rows="4" placeholder="Mensaje" required=""></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit12" class="btn-submit">Enviar ahora</button>
</div>
</form>
and this is my php one:
<?php
$subjectm = $_POST['subject'];
$txt = $_POST['txt'];
$section = $_POST['section'];
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$to = "soporte#colegiolavictoria.holixgaming.com";
$subject = "".$subjectm." | Solicitud de Soporte - Colegio La Victoria";
$headers = "From: " . $email . "\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "CC: soporte#colegiolavictoria.holixgaming.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "
<html>
<head>
<title>".$subjectm." | Solicitud de Soporte - Colegio La Victoria</title>
</head>
<body>
<h3><b>Nombre:</b> </h3><h5>".$name."</h5>\n \n \n</br>
<h3><b>Grado y sección: </h3><h5></b>".$section." <b>\n \n \n</br></h5>
<h3><b>Correo Electronico:</b> </h3><h5>".$email."\n \n \n</br></h5>
<h3><b>Numero de Telefono:</b> </h3><h5>".$phone."\n \n \n</br></h5>
<h3><b>Mensaje: </b></h3><h5>".$txt."\n \n \n</br></h5>
<h2>Este es un mensaje automatizado, favor de no contestar al mismo.</h2>
</body>
</html>
";
mail($to, $subject, $message, $headers);
?>
so, the problem is: when i hit the send button, i get the email but its empty (is getting info from index.php to sendemail.php), i tryied everything but i cant fix it.
This is the message im getting on my mail:
Nombre:
Grado y sección:
Correo Electronico:
Numero de Telefono:
Mensaje:
Este es un mensaje automatizado, favor de no contestar al mismo.
(Obviusly its empty)
I couldn't find the exact issue with your code but I found success by combining the two files into one as seen in the following code.
<?php if ( !empty($_POST) )
{
$subjectm = $_POST['subject'];
$message = $_POST['message'];
$section = $_POST['section'];
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$to = "soporte#colegiolavictoria.holixgaming.com";
$subject = "".$subjectm." | Solicitud de Soporte - Colegio La Victoria";
$headers = "From: " . $email . "\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "CC: soporte#colegiolavictoria.holixgaming.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "
<html>
<head>
<title>".$subjectm." | Solicitud de Soporte - Colegio La Victoria</title>
</head>
<body>
<h3><b>Nombre:</b> </h3><h5>".$name."</h5>\n \n \n</br>
<h3><b>Grado y sección: </h3><h5></b>".$section." <b>\n \n \n</br></h5>
<h3><b>Correo Electronico:</b> </h3><h5>".$email."\n \n \n</br></h5>
<h3><b>Numero de Telefono:</b> </h3><h5>".$phone."\n \n \n</br></h5>
<h3><b>Mensaje: </b></h3><h5>".$message."\n \n \n</br></h5>
<h2>Este es un mensaje automatizado, favor de no contestar al mismo.</h2>
</body>
</html>
";
mail($to, $subject, $message, $headers);
}
?>
<form id="main-contact-form" name="contact-form" method="post" action="">
<div class="row wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Nombre Completo" required="">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Correo Electronico" required="">
</div>
</div>
</div>
<div class="form-group">
<input type="text" name="phone" class="form-control" placeholder="Numero de telefono" required="">
</div>
<div class="form-group">
<input type="text" name="section" class="form-control" placeholder="Grado & Sección" required="">
</div>
<div class="form-group">
<input type="text" name="subject" class="form-control" placeholder="Subjeto" required="">
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="4" placeholder="Mensaje" required=""></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" class="btn-submit">Enviar ahora</button>
</div>
</form>
I'm guessing that it has something to do with how you are declaring the headers. Try running this, as it's a bit cleaner, and works on my dev machine:
<?php
$subjectm = $_POST['subject'];
$message = $_POST['message'];
$section = $_POST['section'];
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$to = "soporte#colegiolavictoria.holixgaming.com";
$subject = "$subjectm | Solicitud de Soporte - Colegio La Victoria";
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/html; charset=iso-8859-1";
$headers[] = "From: {$email}";
$headers[] = "CC: {$to}";
$headers[] = "Reply-To: {$email}";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
$message = "
<html>
<head>
<title>$subject</title>
</head>
<body>
<h3><b>Nombre:</b> </h3><h5>$name</h5>\n \n \n</br>
<h3><b>Grado y sección: </h3><h5></b>$section<b>\n \n \n</br></h5>
<h3><b>Correo Electronico:</b> </h3><h5>$email \n \n \n</br></h5>
<h3><b>Numero de Telefono:</b> </h3><h5>$phone \n \n \n</br></h5>
<h3><b>Mensaje: </b></h3><h5>$message \n \n \n</br></h5>
<h2>Este es un mensaje automatizado, favor de no contestar al mismo.</h2>
</body>
</html>";
mail($to, $subject, $message, implode("\r\n", $headers));
?>
Related
i've tried to create this contact form and here is the HTML code:
<section class="contact_info_area sec_pad bg_color">
<div class="container">
<div class="row">
<div class="col-lg-3 pr-0">
<div class="contact_info_item">
<h6 class="f_p f_size_20 t_color3 f_500 mb_20">Información de contacto</h6>
<p class="f_400 f_size_15"><span class="f_400 t_color3">Email:</span> admin#doupmedia.com</p>
</div>
</div>
<div class="col-lg-8 offset-lg-1">
<div class="contact_form">
<form action="contact_process.php" class="contact_form_box" method="post" id="contactForm" novalidate="novalidate">
<div class="row">
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" id="name" name="name" placeholder="Tu Nombre">
</div>
</div>
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" name="email" id="email" placeholder="Correo Electrónico">
</div>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Asunto">
</div>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Teléfono">
</div>
</div>
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Página Web de la Empresa">
</div>
</div>
<div>
<script>
$('.calendar').flatpickr({
locale:"es",
minDate: "today",
"disable": [
function(date) {
// return true to disable
return (date.getDay() === 0 || date.getDay() === 6);
}
],
"locale": {
"firstDayOfWeek": 1 // start week on Monday
}
})
</script>
</div>
<div>
<label for="country">Tamaño de clientes aproximado</label>
<select id="clientes" name="country">
<option value="australia">0 - 1k</option>
<option value="canada">1k - 10k</option>
<option value="usa">100k - 1M</option>
<option value="usa">1M - 10M</option>
</select>
<label for="country">¿A qué hora va bien que te llamemos?</label>
<select id="clientes" name="country">
<option value="australia">10:00 - 11:00</option>
<option value="canada">11:00 - 12:00</option>
<option value="usa">12:00 - 13:00</option>
<option value="usa">13:00 - 14:00</option>
<option value="usa">16:00 - 17:00</option>
<option value="usa">17:00 - 18:00</option>
<option value="usa">18:00 - 19:00</option>
<option value="usa">19:00 - 20:00</option>
</select>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<textarea name="message" id="message" cols="30" rows="10" placeholder="Deja tu mensaje..."></textarea>
</div>
</div>
</div>
<div class="custom-control custom-switch custom-switch-light">
<input type="checkbox" class="custom-control-input" id="customSwitch2" required="">
<label class="custom-control-label" for="customSwitch2">He leído y acepto la política de privacidad y protección de datos.</label>
</div>
<br>
<button type="submit" class="btn_three" >Enviar Mensaje</button>
</form>
<div id="success">¡En breves nos pondremos en contacto contigo!</div>
<div id="error">Opps! Ha habido un error. Porfavor inténtelo de nuevo.</div>
</div>
</div>
</div>
</div>
</section>
And when I try to edit the contact.php which is called contact_process.php it jumps a white page with thhat error: Cannot POST / contact_process.php
If somebody knows the answer please help.
<?php
$to = "runjiebusiness#gmail.com";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$name2 = $_REQUEST['name2'];
$csubject = $_REQUEST['subject'];
$cmessage = $_REQUEST['message'];
$headers = "From: $from";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "You have a message from your Doup Media.";
$logo = '';
$link = '#';
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Bixcoin Master Mail</title></head><body>";
$body .= "<table style='width: 100%;'>";
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>";
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>";
$body .= "</td></tr></thead><tbody><tr>";
$body .= "<td style='border:none;'><strong>Name:</strong> {$name}</td>";
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>";
$body .= "</tr>";
$body .= "<tr><td style='border:none;'><strong>Subject:</strong> {$csubject}</td></tr>";
$body .= "<tr><td></td></tr>";
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>";
$body .= "</tbody></table>";
$body .= "</body></html>";
$send = mail($to, $subject, $body, $headers);
?>
the _REQUEST variable is missing the field "name2". so the PHP script fails:
$name2 = $_REQUEST['name2'];
This means you need to add an input in your form for name2 or remove this in your PHP script.
I have a problem with a contact form I'm building because it sends the message without sender info (name & email) and no message as well. And I need that. I tried the var_dump from another post I found but did not work.
HTML
<form action="form_process.php" class="contact_form" method= "post" onsubmit>
<ul>
<li><label for="name">name:</label><input type="text" required /></li>
<li><label for="email">email:</label><input type="email" name="email" required /></li>
<li><label for="message">message:</label><textarea name="message" cols="40" rows="6" required ></textarea></li>
<li><button class="submit" type="submit">Enviar</button></li>
</ul>
</form>
</div>
PHP
<?php
$name = var_dump($_POST['name']);
$email = var_dump($_POST['email']);
$message = var_dump($_POST['message']);
$to = "mmechenique#gmail.com";
$subject = "Nuevo mensaje formulario de contacto";
mail ($to, $subject, $message, "From: " . $name);
echo "Tu mensaje ha sido enviado, muchas gracias!";
?>
Try using your form this way:
<form action="form_process.php" class="contact_form" method= "post">
<ul>
<li><label for="name">name:</label><input type="text" name="name" required /></li>
<li><label for="email">email:</label><input type="email" name="email" required /></li>
<li><label for="message">message:</label><textarea name="message" cols="40" rows="6" required ></textarea></li>
<li><button class="submit" type="submit">Enviar</button></li>
</ul>
</form>
</div>
PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = "mmechenique#gmail.com";
$subject = "Nuevo mensaje formulario de contacto";
mail ($to, $subject, $message, "From: " . $name);
echo "Tu mensaje ha sido enviado, muchas gracias!";
?>
Your HTML should look like:
<form action="form_process.php" class="contact_form" method="post">
<ul>
<li>
<label for="name">name:</label>
<input type="text" name="name" required />
</li>
<li>
<label for="email">email:</label>
<input type="email" name="email" required />
</li>
<li>
<label for="message">message:</label>
<textarea name="message" cols="40" rows="6" required ></textarea>
</li>
<li>
<button class="submit" type="submit">Enviar</button>
</li>
</ul>
</form>
Your PHP should look like:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = "mmechenique#gmail.com";
$subject = "Nuevo mensaje formulario de contacto";
$headers = "From: Enter something here < email#mail.com >\r\n";
$headers .= "X-Sender: Enter something here < email#mail.com >\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "X-Priority: 1\r\n"; // Urgent message!
$headers .= "Return-Path: email#mail.com\r\n"; // Return path for errors
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
mail ($to, $subject, $message, $headers);
echo "Tu mensaje ha sido enviado, muchas gracias!";
?>
I shouldn't be giving out the answer so easily because you should have done your research before posting your question but what the hell. Now you know for next time to do SOME research before posting your question.
EDIT:
<?php
$headers = "From: Enter your name < myemail#mail.com >\n"; //If you are the one sending the email enter your name here
OR
$headers = "From: ".$name." < ".$email." >\n"; // If you are the one the email is being sent to then try this header
$headers .= "X-Sender: Enter your name < myemail#mail.com >\n"; //Same logic applies for this guy
OR
$headers .= "X-Sender: ".$name." < ".$email." >\n"; //Same logic applies for this guy
?>
This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 6 years ago.
I have a form in html file and I'm trying to get email on my gmail account when user fill the form and submit it. My website is running on Server not on local host.My code has no error but still not getting the email .I dont know why? Can any one give me sample code or tell me what am I doing wrong? .. Thanks in advance ...
Here is my Code
<form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="row wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Name" required="required">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Email Address" required="required">
</div>
</div>
</div>
<div class="form-group">
<input type="text" name="subject" class="form-control" placeholder="Subject" required="required">
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="4" placeholder="Enter your message" required="required"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn-submit">Send Now</button>
</div>
</form>
And the sendemail.php is
<?php
$name = #trim(stripslashes($_POST['name']));
$from = #trim(stripslashes($_POST['email']));
$subject = #trim(stripslashes($_POST['subject']));
$message = #trim(stripslashes($_POST['message']));
$to = 'khurram.ansar#gmail.com';
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: {$name} <{$from}>";
$headers[] = "Reply-To: <{$from}>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
mail($to, $subject, $message, $headers);
die;
According to the documentation :
Multiple extra headers should be separated with a CRLF (\r\n).
So your php file should be like :
<?php
$name = #trim(stripslashes($_POST['name']));
$from = #trim(stripslashes($_POST['email']));
$subject = #trim(stripslashes($_POST['subject']));
$message = #trim(stripslashes($_POST['message']));
$to = 'khurram.ansar#gmail.com';
$headers = "MIME-Version: 1.0" . "\r\n" .
"Content-type: text/plain; charset=iso-8859-1" . "\r\n" .
"From: {$name} <{$from}>" . "\r\n" .
"Reply-To: <{$from}>" . "\r\n" .
"Subject: {$subject}" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
die;
?>
I have a contact form in my website and it doesn't work properly. I get the email but the email it's empty, I don't get the information from the form.
the part of the html in my index.html
<form role="form" form name="contactform" method="post" action="send_form_email.php">
<div class="form-group">
<label>Nombre</label> <input type="text" name="nombre" class="form-control" placeholder="Introduce tu nombre" >
</div>
<div class="form-group">
<label>Apellidos</label> <input type="text" name="apellidos" class="form-control" placeholder="Introduce tus apellidos" >
</div>
<div class="form-group">
<label>Email</label> <input type="emal" name="email" class="form-control" placeholder="Introduce tu email" >
</div>
<div class="form-group">
<label>Telefono</label> <input type="text" name="telefono" class="form-control" placeholder="Introduce tu telefono" >
</div>
<div class="form-group">
<label>Mensaje</label> <textarea name="mensaje" class="form-control" rows="7"></textarea>
</div>
<button type="submit" class="btn btn-default" value="Submit"> Enviar
</form>
</div>
the part of the php file called "send_form_email.php"
<?php
$nombre = $_POST['nombre'];
$apellidos = $_POST['apellidos'];
$telefono = $_POST['telefono'];
$email = $_POST['email'];
$mensaje = $_POST['mensaje'];
$formcontent=" $nombre $apellidos $email $telefono $mensaje";
$recipient = "deniz946#gmail.com";
$subject = "Subject from $nombre";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You! We will get back to you as soon as possible!" . " -" . "<a href='./index.php'> Back to site</a>";
?>
<input type="emal" name="email" class="form-control" placeholder="Introduce tu email" > change to
<input type="email" name="email" class="form-control" placeholder="Introduce tu email" >
you have typo in type attribute.
Try this
<?php
$nombre = $_POST['nombre'];
$apellidos = $_POST['apellidos'];
$telefono = $_POST['telefono'];
$email = $_POST['email'];
$mensaje = $_POST['mensaje'];
$formcontent = "{$nombre} {$apellidos} {$email} {$telefono} {$mensaje}";
$recipient = "deniz946#gmail.com";
$subject = "Subject from $nombre";
if(PHP_OS == "Linux" || PHP_OS == "Darwin") $new_line = "\n"; /* if Linux or Mac */
elseif(PHP_OS == "WINNT") $new_line = "\r\n"; /* if Windows */
$mailheader = "MIME-Version: 1.1" . $new_line;
$mailheader .= "Content-type: text/html; charset=utf-8" . $new_line;
$mailheader .= "From: ".$recipient.$new_line;
$mailheader .= "Return-Path: " . $recipient . $new_line;
$mailheader .= "Reply-To: " . $recipient . $new_line;
mail($recipient, $subject, $formcontent, $mailheader, "-r" . $recipient) or die("Error!");
echo "Thank You! We will get back to you as soon as possible!" . " -" . "<a href='./index.php'> Back to site</a>";
?>
Perhaps I can help you with an example I used myself:
The HTML contact Form:
<div class="row">
<!-- Content -->
<div id="content" class="8u skel-cell-mainContent">
<section class="12u">
<header>
<h2>Contact</h2>
</header>
<form method="post" action="mail.php">
<div class="row half">
<div class="6u">
<input name="subject" placeholder="Name" type="text" class="text" />
</div>
<div class="6u">
<input name='email' placeholder="Email" type="text" class="text" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row half">
<div class="12u">
<!--a href="mail.php" class="button">Submit</a-->
<input type="submit" class="button" value="Submit">
</div>
</div>
</form>
</section>
</div>
The PHP processing of the form:
<?php
//mail(to,subject,message,headers,parameters)
// Check if the "from" input field is filled out
//if (isset($_POST['from']))
//{}
$to = 'mail#xxxxxx.com'; // my email address
$subject = $_POST['subject']; //name client
$feedback = 'thank you, we will reply soon.';
$header = $_POST['email']; //Email client
$message = $_POST['message'];
$message = wordwrap($message, 70);
$message = <<<EMAIL
Dear (YOUR WEBSITE NAME HERE),
My name is: $subject
$message
Email Client: $header
EMAIL;
// send mail
if($_POST){
mail($to, $subject, $message, $header);
echo $feedback;
}
?>
Remember very carefully, the part from Dear... to EMAIL has to be against the left side of the screen, without any tabs or spaces. Else it won't work!
Hopefully you can use this to your success :)
I have a website Html5 and try adding the reCaptcha still sending messages without activating the reCaptcha and last night I received over 300 messages a boot.
Help me please how to add so that only sent when the button is activated reCaptcha.
Send sends works well but not activation reCaptcha.
To start contact.html within my template I have put this way:
<!-- Start formulario de contacto -->
<div class="row">
<div class="col-md-9">
<h2>Formulario de contacto</h2>
<form action="php/contact-form.php" id="contact-form">
<div class="alert alert-success hidden" id="contact-alert-success">
<strong>Mensaje enviado correctamente!</strong> Muchas gracias, pronto nos pondremos en contacto con usted, normalmente nuestro tiempo de respuesta es inferior a 2 horas.
</div>
<div class="alert alert-danger hidden" id="contact-alert-error">
<strong>Error!</strong> A sucedido un error si lo desea puede contactarnos directamente en XXXX#tize.XXXX
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Nombre <span class="required">*</span></label>
<input type="text"
value=""
data-msg-required="Por favor introduzca su nombre"
class="form-control"
name="name" id="name">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>eMail <span class="required">*</span></label>
<input type="email"
value=""
data-msg-required="Por favor introduzca su eMail"
data-msg-email="Por favor introduzca un eMail válido"
class="form-control"
name="email"
id="email">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Asunto <span class="required">*</span></label>
<input type="text"
value=""
data-msg-required="Por favor introduzca el asunto"
class="form-control"
name="subject"
id="subject">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Mensaje <span class="required">*</span></label>
<textarea
data-msg-required="Por favor introduzca su mensaje"
rows="10"
class="form-control"
name="message"
id="message"></textarea>
</div>
</div>
</div>
<!-- Start Google Recaptcha -->
<div class="g-recaptcha" data-sitekey="6Lc88P4SAAAAANiT-ZXILUo-ET4xQmbivHy7uHc8"></div><br>
<!-- End Google Recaptcha -->
<div class="row">
<div class="col-md-12">
<input type="submit" value="Enviar mensaje" class="btn btn-primary" data-loading-text="Cargando...">
</div>
</div>
</form>
</div>
<!-- End formulario de contacto -->
And in php form to send the messages have this post with contact-form.php :
<?php
session_cache_limiter('nocache');
header('Expires: ' . gmdate('r', 0));
header('Content-type: application/json');
// Enter your email address
$to = 'XXXX#tize.XX';
$subject = $_POST['subject'];
if($to) {
$name = $_POST['name'];
$email = $_POST['email'];
$fields = array(
0 => array(
'text' => 'Name',
'val' => $_POST['name']
),
1 => array(
'text' => 'Email address',
'val' => $_POST['email']
),
2 => array(
'text' => 'Message',
'val' => $_POST['message']
)
);
$message = "";
foreach($fields as $field) {
$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
}
$headers = '';
$headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
if (mail($to, $subject, $message, $headers)){
$arrResult = array ('response'=>'success');
} else{
$arrResult = array ('response'=>'error');
}
echo json_encode($arrResult);
} else {
$arrResult = array ('response'=>'error');
echo json_encode($arrResult);
}
?>
Picture of my form, If anyone wants to see my website please let me know and send you the link. Thank you very much.
sending without activating the reCaptcha http://goo.gl/oSLQG9