Hello everyone,
I'm having some trouble with fixing my contact form, it doesn't send any details to my email address.
The form I made is coded in HTML and I use PHP to send the details away.
I contacted the hosting company of my website and they said the following:
"Mail with another sender than the domain from which it got sended is unfortunately not possible anymore, the mail which will be send from dioncreations.com has to be a @dioncreations.com address. We did this because spammers abused the contact forms multiple times which gave our mail servers some difficulties."
So I'm trying to fix my PHP send script so it will send the details to my email address.
PHP script:
<?php
header('Content-type: application/json');
$status = array(
'type' => 'success',
'message' => 'Email sent!'
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = 'info@dioncreations.com';
$email_to = 'info@dioncreations.com';
$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
?>
HTML script
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="mailer.php" role="form">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<input type="text" class="form-control" id="name" name="name" placeholder="Name" required="required">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="text" class="form-control" id="subject" name="subject" placeholder="Subject" required="required">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<textarea class="form-control" rows="8" id="message" name="message" placeholder="Message" required="required"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-danger btn-lg">Send Message</button>
</div>
</div>
</div>
</form>
Someone told me there are variables missing, but what kind of variables he wouldn't say.
Can someone help me out, so I can continue with my website?
I thank you kindly! Your help is much appreciated.