# Contact Form Setup
The template includes a simple PHP mail script that allows you to gather leads from your website without using any CMS or third-party mailing tool.
Open the mail.php
file from the root template folder with any text editor and change the $recepient
variable to your own email address. Some other variables and text templates are also safe to customize.
<?php
if ($_POST) {
$recepient = 'john@example.com'; // your email
$sitename = 'Kinsey HTML5 Template'; // your site name
$subject = "New contact from \"$sitename\""; // subject template
$name = trim($_POST['visitor_name']);
$email = trim($_POST['visitor_email']);
$msg = trim($_POST['visitor_msg']);
$message = "
-------------------<br><br>
Visitor name: $name <br>
Visitor email: $email <br><br>
$msg
<br><br>-------------------
";
mail($recepient, $subject, $message, "From: $name <$email>" . "\r\n" . "Reply-To: $email" . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'Content-type: text/html; charset="utf-8"');
}
?>
TIP
The frontend setup (form HTML markup, success, and error messages) is described in the Contact Form component article.
# Troubleshooting
If you are experiencing any issues with the mailing script, please contact your hosting provider for assistance and ensure that:
- Your hosting plan supports PHP and it's enabled in your account.
- The PHP mailing function mail() is allowed for execution.
- Your domain is authorized to send emails.
- Emails sent from your website are not going into the spam folder.