Hola amigos, quiero hacer que al completar el formulario el contenido se envie a mi correo electrónico. ME podríais decir que tengo que editar en este codigo para que me seriva? Mucha sgracias de antemano.
_____________
$(".submit").click(function() {
var hasError = false;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var senderNameVal = $(this).parent().children(".sender_name").val();
if(senderNameVal == '' || senderNameVal == ' ' || senderNameVal == 'Name...' || senderNameVal == 'Venue Name...') {
$(this).parent().children(".sender_name").css({ "border" : "1px solid #f00" });
hasError = true;
}
var emailFromVal = $(this).parent().children(".emailFrom").val();
if(emailFromVal == '') {
$(this).parent().children(".emailFrom").css({ "border" : "1px solid #f00" });
hasError = true;
} else if(!emailReg.test(emailFromVal)) {
$(this).parent().children(".emailFrom").css({ "border" : "1px solid #f00" });
hasError = true;
}
var subjectVal = $(this).parent().children(".subject").val();
if(subjectVal == '' || subjectVal == ' ' || subjectVal == 'Subject...' || subjectVal == 'Location...') {
$(this).parent().children(".subject").css({ "border" : "1px solid #f00" });
hasError = true;
}
var messageVal = $(this).parent().children(".message").val();
if(messageVal == '' || messageVal == ' ') {
$(this).parent().children(".message").css({ "border" : "1px solid #f00" });
hasError = true;
}
if(hasError == false) {
// Next four lines of code reverse the "red outline" error styling if there was any
$(this).parent().children(".sender_name").css({ "border" : "1px solid #ddd" });
$(this).parent().children(".emailFrom").css({ "border" : "1px solid #ddd" });
$(this).parent().children(".subject").css({ "border" : "1px solid #ddd" });
$(this).parent().children(".message").css({ "border" : "1px solid #ddd" });
$(this).css({ 'opacity' : '.5', 'width' : 'auto' });
$(this).val('Mensaje enviado.');
emailType = $(this).parent().parent().attr('class'); // If you change the classes, change the values in the next if statement below
if(emailType == 'userEmail' || emailType == 'venueEmail') {
$.post("emailForm.php",
{ mailFrom: emailFromVal, subject: subjectVal, message: messageVal, headers: "From:" + senderNameVal },
function(data) {
});