Hi
I need help, how to send email with this code I have absolutely no idea.
<script type="text/javascript">
jQuery(function ($) {
$('#contact-form').submit(function () {
var email = $('#mail').val();
var name = $('#name').val();
var msg = $('#comments').val();
$.ajax({
type: 'POST',
url: 'contact.php',
data: {
'key': 'sVRLFidC1A7K56TuUkyUQg',
'message': {
'from_email': email,
'from_name': name,
'headers': { 'Reply-To': email },
'subject': 'Website Contact Form Submission',
'text': msg,
'to': [{
'email': 'admin@mydomain.com',
'name': 'Riyadh Al Nur',
'type': 'to'
}]
}
}
}).done(function (response) {
alert('Your message has been sent. Thank you!');
$('#name').val('');
$('#email').val('');
$('#msg').val('');
}).fail(function (response) {
alert('Error sending message.');
});
return false;
});
});
</script>
contact.php
<?php
mail('niemand@example.com', 'Betreff', 'Nachricht', null,
'-fwebmaster@example.com');
?>