PHP Mail - not sending

I recently added a contact page to my site, where a user can send an email to me if they have a query.

I used the https://www.bitdegree.org/learn/php-mail-function example, and it displays correctly on the page, but does not send the email. It simply takes me to the 000webhost home page.

Have I done something wrong?

or better yet - does anyone know of any good scripts to use? :slight_smile:

Try using this one: http://www.000webhost.com/forum/7306-post51.html

Thanks for that. :slight_smile: I did find another script, and it is working perfectly.

Thanks for responding :slight_smile:

Michael, I have the same trouble. Can you tellme what is the another scrip what you find??
Thanks a lot.

I’m about to remove mine, due to spam. My script does not have an adequate spam detection function.

Try using the one sizzlefire mentioned.
Sorry I can’t help.

Thanksyou for all

Hi

I want to use contact form, but don’t send the message. [COLOR=“Red”]Why?[/COLOR]

The script:

<?php
$Name = $_POST[‘Name’];
$Email = $_POST[‘Email’];
$Comment = $_POST[‘Comment’];

$To="MYMAIL@gmail.com";
$Subject=“Contact form, Your Website”;
$Answer=$_POST[‘Answer’];
$Yanswer=$_POST[‘Yanswer’];

$Message=“
From: $Name
Email: $Email
$Comment”;

if ($Answer==$Yanswer){
mail($To,$Subject,$Message);
include (‘contact.html’);}
else{
include (‘error.html’);
}
?>

Validation code:
<?php>
$A= rand(1, 9);
$B= rand(1, 9);
$C=$A+$B;
?>

Edit:
[COLOR=“Red”]This script working perfectly on another free website provider!!![/COLOR]
What is wrong on 000webhost???

I tried an other contact form (www.freecontactform.com), but this does not send mail.
The letter sending is successful apparently.

:confused::mad:

Here is a PHP form mail script:

PHP Form Mail Script.

Thanks, i will try later!

No problem.

Don’t work… :mad:
There is some fatal mistake in the server.

I have to look for an other free web hosting provider. :frowning:

Working for somebody the contact form on this server?

I have the same problem with the php mail function. I have 2 accounts on this host and the one with my domain is not sending mails. The other one works perfectly.
I can’t be blocked for spam because it’s not a huge site to send many e-mails, and i didn’t send mass mails.
Where can be the problem?
I tested the mail function with the simplest php code:

<?php
$to = "my_other_email@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "my_email@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
if (mail($to,$subject,$message,$headers)) echo "Mail Sent.";
else echo "Not sent";
?> 

Here try this contact form out it might work:


<html>
<body>
<form action="MAILTO:YOUR@EMAIL.COM" method="post" enctype="text/plain">

<h3>Contact Form.</h3>
Name:<br>
<input type="text" name="name"
value="yourname" size="20">
<br>
Mail:<br>
<input type="text" name="mail"
value="yourmail" size="20">
<br>
Comment:<br>
<input type="text" name="comment"
value="yourcomment" size="40">
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">

</form>
</body>
</html>

thanks, but i have problems with the mail function.
the script you posted is good, but without a captcha your mailbox would be full of spam in a minute…:))

which server? server37.000webhost.com?

Use this captcha:

http://image.captchas.net?client=demo&random=RandomZufall

(it’s an image link but i think it changes still)

I’ve sent a ticket, so no need to send more.
yes, i’m on the same server (server37.000webhost.com). they said, they will check the server settings.