I am somewhat new to programming. I have a form that when submitted, sometimes makes it to my email, and sometimes doesn't. My webhost provider is Bluehost. I can't see any errors in my code, but I might be mistaken. I'm thinking that since sometimes it works, and sometimes it doesn't, it must be a lack of reliability of Bluehost's server. Please note that I have the form submission coming from my own email address to my own email address, to prevent it going to my spam folder.
Mail form:
<form class='contact-form' action='mail.php' method='POST'>
<input class='form-input' type='text' name='name' placeholder='Full Name' required />
<input class='form-input' type='email' name='email' placeholder='Email' required />
<input class='form-input' type='text' name='phone' placeholder='Phone' required />
<textarea class='form-input' type='text' name='message' rows=5 placeholder='Tell me about your project...' required></textarea>
<input type='submit' class='cta-btn form-submit' />
</form>
And here is my PHP code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$sender = 'myemailaddress@gmail.com';
$recipient = 'myemailaddress@gmail.com';
$subject = 'Web Development Inquiry';
$mailheader = "From: $sender \r\n";
$formContent = "Name: $name \n Email: $email \n Phone: $phone \n Message: $message";
mail($recipient, $subject, $formContent, $mailheader);
?>