I have tried using my contact form with XAMPP i have configured .ini files etc. correctly to GMAIL for testing purposes. Can you see where I have made a mistake?
I have even tried WAMP and still nothing works.
I changed the xwamp files as this guy suggested: How to configure XAMPP to send mail from localhost?
HTML
<form method="post" action="contact-form.php" name="contactform" id="contactform">
<fieldset>
<input name="name" type="text" id="name" placeholder="Name"/>
<input name="email" type="text" id="email" placeholder="Email"/>
<input name="subject" type="text" id="subject" placeholder="Subject"/>
</fieldset>
<fieldset>
<textarea name="comments" cols="40" rows="3" id="comments" placeholder="Message"></textarea>
</fieldset>
<input type="submit" class="submit" id="submit" value="Send Message" />
</form>
JS
$('#contactform').submit(function(){
var action = $(this).attr('action');
$("#message").slideUp(250,function() {
$('#message').hide();
$('#submit')
.after('<img src="img/assets/cbp-loading.gif" class="loader" />')
.attr('disabled','disabled');
$.post(action, {
name: $('#name').val(),
email: $('#email').val(),
subject: $('#subject').val(),
comments: $('#comments').val(),
},
function(data){
document.getElementById('message').innerHTML = data;
$('#message').slideDown(250);
$('#contactform img.loader').fadeOut('slow',function(){$(this).remove()});
$('#submit').removeAttr('disabled');
if(data.match('success') != null) $('#contactform').slideUp(850, 'easeInOutExpo');
}
);
});
return false;
PHP
<?php
if (isset($_POST["submit"])) {
$name = $_POST['name'];
$email = $_POST['email'];
$subject = 'Message from Contact Demo ';
$message = $_POST['message'];
$from = 'Demo Contact Form';
$to = 'myemail@gmail.com';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
mail('myemail@gmail.com', $name, $email, $subject, $message);
}
?>
Sendmail code (i have removed the email and password obviously)
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=MYEMAIL@gmail.com
auth_password=MY EMAIL PASSWORD
force_sender=MYEMAIL@gmail.com