Problem with the php mail () function

I can not send mails with php mail ().
However, I have enabled the mail () function.
The mail function responds as if it had worked but I do not receive the mail and in the statistics my number of emails sent stays on 0?

<?php $headers = "From:" . "\r\n" ."CC:"; if(mail("","coucou","coco",$headers)){echo " envoi OK ";} else {echo "envoi erreur";} ?>

Have a look at this tutorial, it might help you! :wink:

<?php $name = trim($_POST['name']); $name = trim($_POST['lname']); $email = trim($_POST['email']); $email = trim($_POST['job']); $phone = trim($_POST['phone']); $subject = trim($_POST['subject']); $message = trim($_POST['message']); $emailTo = 'your email id'; //Put your own email address here if (empty($subject)) { $subject = 'Message from your website.'; } $body = "Name: $name \n\nEmail: $email \n\nMessage: $message " ; $headers = 'From: '.$email."\r\n" . 'Reply-To: '.$email."\r\n"; mail($emailTo, $subject, $body, $headers); $emailSent = true; echo ('success'); ?>



Thank you, I try but :

  1. the sendmail is on;
  2. Sendmail Daily Quota (50) is on 0% used
  3. Using your mail function code, this does not work.

Can you please post a screenshot of your mail() code?

I have the same problem php mail seems not to be working for the last day or so.

Please post a screenshot about your code so we can check this together


The code is entirely in my first question, it’s the whole .php page:

<?php $headers = "From:" . "\r\n" ."CC:"; if(mail("","coucou","coco",$headers)){echo " envoi OK ";} else {echo "envoi erreur";} ?>


Did you try this code?


$subject = "YOUR SUBJECT HERE";
$headers = "MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8";
mail ($to, $subject, $body, $headers);


Yes, I tested this code before yesterday as well as right away and it does not work:sob:

I’ve forwarded this issue to the administrators :slight_smile: I’ll let you know when they reply

Any update please as mail() is still not working.

@r0nmlt Php mail function is working fine.
Try this liink,

then gmail must be blocking all mail arriving from 000webhost as your link didn’t send the mail to my gmail account.

even ( is not receiving emails using that link. i will try mx toolbox and see if 000webhost is blacklisted.

@r0nmlt You didn’t receive any mail because all mail are sent to my mail.

Check with your mail function script once,

my script was working and one fine day it just stopped sending out mail (to my email address).

This is really driving me crazy. I am even trying the following code and still doesn’t work.

mail('', 'test subject', 'test', '');
echo "All Done - " . date("Y/m/d , H:i:s") ;

It cannot get easier than that, yet it just doesn’t work from I tried the same on heliohost and it works so it must be my account.

Check out your email, I modified your code, and it seems to have sent the email.

yes i noticed.

it gives a sent result

BUT the mail is not received!

you might have noticed from the script i had before i was even trying all different PHP versions, as somebody else is having the same problem but fixed it with a different version.

I tried all 7 versions and none of them resulted in a mail effectively delivered.

Can you switch to 5.2?