html - PHP contact form giving error -
my basic contact form giving me error "error during sending mail". of course, code below simple , has no protection against spammers or sql injection, main concern @ moment getting message send.
thanks in advance given, despite simplicity of question.
html:
<form action="sendmail.php" method="post"> <table> <tr> <td>name:</td> <td><input type="text" name="name" size="20" maxlength="40" /></td> </tr> <tr> <td>email:</td> <td><input type="text" name="email" size="20" maxlength="60" /></td> </tr> <tr> <td>message:</td> <td><textarea name="message" maxlength="1000" cols="25" rows="6"></textarea></td> </tr> </table> <div align="left"> <input name="submit" type="submit" /> </div> </form>
sendmail.php php:
<?php if(isset($_post['submit'])) { $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: cwon australia'; $to = "......@hotmail.com"; $subject = "cwon message"; $content = "from: $name\n e-mail: $email\n message:\n $message"; if(mail ($to, $subject, $content, $from)) { echo "mail has been sent"; } else { echo "error during sending mail"; } } ?>
your code functional, , assume you're getting "mail has been sent" response.
if aren't, you'll first want check php.ini correct sendmail path (this believe default):
sendmail_path = /usr/sbin/sendmail -t -i
if sendmail path good, see email in mail logs? i'd test mailing user account on server itself.
it's more you're getting owned spam filter, if you're emailing "@hotmail.com" address.
Comments
Post a Comment