I can't get the email to be sent, I don't know what I'm doing wrong but the more I check I don't know what's going on... I'm using 000webhost with PHP 7.2
<?php
$email = "[email protected]";
$message = "Hi";
if (// SI LAS INSTRUCCIONES SE CUMPLEN) {
$email_post = $email;
$asunto = "Repost";
$msg = $message;
$header = "From: [email protected]" . "\r\n\";
$header.= "Reply-To: [email protected]" . "\r\n\";
$header.= "X-Mailer: PHP/". phpversion();
mail($email_post,$asunto,$message,$header);
}
?>
The slashes
\
at the end of the first two$header
may be escaping the double quotes that follow them .Apart from that, you should complete your code, putting a
else
where you verify that the conditions you are talking about are met or not. And also verifying if the sending of the message specifically fails. And also, it is convenient that you clean the code of redundant variables, if you already have the email in this: nor this:$email
does not make sense , just use and , why do you create variables with other variables that already exist?$email_post = $email;
$msg = $message;
$mail
$message
This is how it should work, or at least inform you more precisely of what is happening.
Try this way and tell us what counts
$outPut
. Do not write code where aspects remain uncovered. Then the code says nothing and you don't know why.