php - Why is contact form not sending email to client? -
when change email personal hotmail address, message turns - although in spam folder. when change client's email, message doesn't turn @ all. know how can fix this?
this php form:
<?php if(isset($_post['submit'])) { $name = $_post['name']; $address = $_post['address']; $number = $_post['number']; $email = $_post['email']; $message = $_post['message']; $subject = 'message reef cleaning solutions website'; $to = 'info@address.co.uk'; if (empty($name) || empty($address) || empty($number) || empty($email) || empty($subject) || empty($message)) { if (empty($name)) $error['name'] = "please enter full name"; if (empty($address)) $error['address'] = "please enter address"; if (empty($number)) $error['number'] = "please enter contact number"; if (empty($email)) $error['email'] = "please enter valid email address"; if (empty($message)) $error['message'] = "please write message, enquiries or other concerns above"; } else { //if not empty $body = " name: $name\r\n address: $address\r\n number: $number\r\n email: $email\r\n message: $message "; $headers="from: {$email}\r\nreply-to: {$email}"; //create headers email if(mail($to,$subject,$body,$headers)) { $success = "mail has been sent"; } else { echo "error during sending mail"; } } } ?> this html
<form method="post"> <table border="1"> <tr> <td><label for="name" class="g">name</label></td> <td><input id="name" name="name" type="text" autofocus required /></td> </tr> <tr> <td><label for="address" class="g">address</label></td> <td><textarea rows="3" id="address" name="address" cols="50"></textarea></td> </tr> <tr> <td><label for="number" class="g">contact number</label></td> <td><input id="number" name="number" type="text" autofocus required /></td> </tr> <tr> <td><label for="email" class="g">email</label></td> <td><input id="email" name="email" type="text" placeholder="example@domain.com" autofocus required /></td> </tr> <tr> <td><label for="message" class="g">enquiry</label></td> <td><textarea rows="3" id="message" name="message" required cols="50"></textarea></td> </tr> </table> <input type="submit" value="submit" name="submit" /> <div id="message-sent"> <?php if ($success) { echo $success; } ?> </div> </form>
if receive message on email, it's not problem php code, because send mail.
so, configured email correct ? can send email address personnal address ?
you tell email considered spam on personnal address, maybe it's same thing other address, message dont fall in "spam" folder, not allowed enter mailbox.
Comments
Post a Comment