Problem with the php mail () function

Hello,
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: test@gmail.com" . "\r\n" ."CC: test2@gmail.com"; if(mail("nom1@laposte.net","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'); ?>

more: http://budnetdomain.in/ecommerce.php

Bonjour,

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

Hello,

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

<?php $headers = "From: test@gmail.com" . "\r\n" ."CC: test2@gmail.com"; if(mail("nom1@laposte.net","coucou","coco",$headers)){echo " envoi OK ";} else {echo "envoi erreur";} ?>

Thanks

Did you try this code?

<?php

$to = "THE ADDRESS YOU WANT TO SEND THE EMAIL TO";
$subject = "YOUR SUBJECT HERE";
$body = "YOUR BODY GOES HERE";
$headers = "MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8";
mail ($to, $subject, $body, $headers);

?>

Hello,
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,
https://testingsm.000webhostapp.com/

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

even outlook.com (hotmail.com) 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.

<?php
mail('myemailaddress@gmail.com', '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 000webhostapp.com. 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?