PHP form > How to >
PHP form not working
My PHP form is not working, not sending any mail
You followed my step-by-step PHP form tutorial,
uploaded the sample PHP form code, submitted the form and got the
"Your form has been submitted" message. But no matter how many times
you try, your PHP form is not working. It's just not sending mail, you don't receive
any form results. Now what?
Here are a few things to check if your form isn't working:
» Time heals all wounds?
Wait an hour or so before panicking as there could be a delay between the e-mail
is sent and your mail serve receives it. No luck? Ok, worth a try...
» Marked as SPAM?
The form e-mail could have been mistaken for SPAM by a SPAM filter (on your PC,
on your server, your mail provider probably has built-in SPAM filters, ...).
Check inside your SPAM/Junk/Bulk folder to see if the form mail ended up
there. If your SPAM filter supports it try adding the From: address to
a whitelist (always accept mail from).
» Sending mail to remote addresses blocked?
Some hosts prevent the user "nobody" from sending out mail to remote
addresses (PHP and CGI scripts generally run as nobody). When testing your form
make sure the recipient e-mail address is a local address (@yourwebsite.com) rather then a
third party email provider (gmail, hotmail, yahoo, aol, your ISP, ...).
For example if your form is hosted on mywebsite.com
make sure the recipient address is email@example.com
(a local domain e-mail address like firstname.lastname@example.org, email@example.com,
» Is PHP mail() function working?
It's quite possible PHP mail() function is either disabled
or not configured properly on your server. An easy way to check if
e-mail sending is working is using this code. It's as simple as it gets,
if this code doesn't work no other will:
mail('firstname.lastname@example.org','Test mail','The mail function is working!');
echo 'Mail sent!';
- Save this code as mailtest.php
- change email@example.com to your e-mail address
- upload mailtest.php to your server
- open mailtest.php in your browser (http://yourwebsite.com/mailtest.php)
- check your inbox to see if a test message arrived.
Did the test mail arrive?
- double-check your form script for errors (like e-mail address misspelling)
- use the same e-mail address as your form recipient
- double-check your SPAM filters and SPAM/Junk/Bulk mailboxes
Your host has either disabled sending mail with PHP or it is not
configured properly. In any case contact your host and ask them
to check PHP mail() settings. You can give them a link to your
mailtest.php script to show you tested it with a script as simple
as it gets and it's just not working.
If your host doesn't want to enable PHP mail I recommend that
you get a better PHP hosting company.
If you are your own host (run PHP on your own machine) it's up to you
to configure PHP properly. How? Check PHP manual or
Hope this helps!
» Copyright notice
© 2008-2015 myPHPform.com. All rights reserved. Copying or redistributing
any part of this website without our written permission is expressly