I just get a page with the php code printed on it.
You either do not have PHP set up correctly for your server, or you are not accessing the script correctly.
I am presuming you are doing this on your own computer, which usually assumes the name “localhost” by default.
Put a test file in your htdocs folder (find out where that is by looking in your documentation OR check your HDD for php.ini and look in that for the entry next for “doc_root”)
call your file test.php
<p>This is HTML, so you found the right file ....</p>
<?php
echo "<p>PHP said this!</p>" ;
?>
and put it in that doc_root folder, then in your browser enter
hm the script seems to work when i put it on a webserver, but i don’t get an e-mail in my inbox. It just displays:‘thank you for your e-mail’ but then i receive nothing…
If your problem is “my script does not work locally but it does work on another” server then your problem still remains which are you doing wrong locally.
Setting PHP up?
Accessing your scripts?
In this case stay away from mail() for now, just get PHP to echo something onto a page to prove the point - that is if you are bothered that PHP does not work locally.
Thats about it, put your own email as the $to, then navigate your browser to that page, that is a fundamental test of whether mail() is working.
Alternatives? Find a better hosting company.
Get a gmail account and connect and send to it using their API, there are lots of similar services but they likewise require you to learn how to use their APIs.
We have not read the forum post but can confirm php mail is enabled on free hosting.
For best email delivery we recommend upgrading to premium hosting or using remote Google mail SMTP servers:
thanks for your response. I uploaded test.php to the webserver and filled in my own email, surfed to the page and got the message : “email sent”.
Sadly i never received an email - what could the issue be?
Change the email to your own email address and then put that file called test.php on your server, then navigate to it using your browser.
yourwebsite . com/test.php
From the manual on mail()
[B]Return Values
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. [/B]