I'm try to sent email by my localhost php, but the problem is i didn't receive anything in my email, what should i configure?
Here is my code
$to="[email protected]";
$name="jason";
$subject="test message";
$header="From: $name";
$message="blah blah blah";
$sentmail=mail($to,$subject,$message,$header);
echo $sentmail ? "email send" : "email send fail"?
as the result was "email send"
There are 2 reason not to send email from your localhost..
So either you have to configure the mail server but I don't think that this is a handy solution.
Better you try to use SMTP service. To do this it will be better if your use PHPMailer.
Here is an example using PHPMailer class.
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "mail.example.com"; // SMTP server example
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "username"; // SMTP account username example
$mail->Password = "password";
You can use this class for any kind of email as a alternative of PHP : mail().
mail function will Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
mail function will not check whether mail reached in your inbox
http://php.net/manual/en/function.mail.php
You can't check whether mail has been delivered, but you can check whether the recipients opened your mail with tracking pixel https://support.google.com/dfp_premium/answer/1347585?hl=en
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With