contact form - PHP mail not functioning -
my php contact form not send email anywhere, inbox or spam. php latest edition , running on server has smtp installed on it. i'm unsure whether it's code or software...
heres php contact script:
<?php $to = "filtered"; $subject = $_post['subject']; $message = $_post['message'] ." from: " .$_post['email']; $from = "contactform@contact.com"; $headers = "from:" . $from; mail($to,$subject,$message,$headers); ?>
and form:
<form method='post' action='contactscript.php'> email: <input name='email' type='text' /><br /> subject: <input name='subject' type='text' /><br /> message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>
to determine whether problem lies in code or in external software, check return value of mail()
.
if ( mail($to,$subject,$message,$headers) ) { echo "message sent"; } else { echo "sending failed."; }
if returns false, error lies in script, or message not accepted delivery mail server.
Comments
Post a Comment