PHP form not workingPHP form not working - not sending mail?
PHP form
 Home   Forms tutorial   How to articles   Link to us   Donations   Contact 

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 something@mywebsite.com (a local domain e-mail address like info@mywebsite.com, webmaster@mywebsite.com, your.name@mywebsite.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:

<?php
mail('you@yourmail.com','Test mail','The mail function is working!');
echo 'Mail sent!';
?>
  • Save this code as mailtest.php
  • change you@yourmail.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?

» YES!

  • 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

» NO...

  • 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 ask Google

 

Hope this helps!

 


Jump to:  
  2.1 PHP form not working
  2.2 Sending form results to multiple recipients
  2.3 Sending an autoresponder message
  2.4 Make sure form e-mails are not blocked by your SPAM filter
  2.5 Stop form SPAM without using Captcha
  2.6 Which method to use for your form: GET or POST?
  2.7 Contact forms or Help desk software?
  2.8 Prevent multiple form submissions
  2.9 Secure order forms
  2.10 Hosting and PHP forms

Help desk software Hesk

» Copyright notice

© 2008-2024 myPHPform.com. All rights reserved. Copying or redistributing any part of this website without our written permission is expressly forbidden!

Page copy protected against web site content infringement by Copyscape

 


Help desk software

Help myPHPform by Donating!

  Home  Forms tutorial  How to articles  Link to us  Donations  Contact  
 
© Copyright PHP form 2008-2024. All rights reserved.
All trademarks are property of their respective owners.
Privacy policy