PHP Check If mail() function is enable

Today, We want to share with you PHP Check If mail() function is enable.In this post we will show you Checking if PHP/WordPress can send mails, hear for Check if PHP mail() function is installed on your server we will give you demo and example for implement.In this post, we will learn about unable to send email with php mail function check your system logs with an example.

PHP Check If mail() function is enable

There are the Following The simple About Checking if PHP/WordPress can send mails Full Information With Example and source code.

As I will cover this Post with live Working example to develop mail() has been disabled for security reasons, so the php mail function success but not sending is used for this example is following below.

Free Live Chat for Any Issue

How to Test and Fix the php mail() Function

if ( function_exists( 'mail' ) )
{
    echo 'Good Luck Your Basic mail() is available';
}
else
{
    echo 'Sorry Dear Your Basic mail() has been disabled';
}  

how to enable php mail function and checking

<?PHP
$sender = '[email protected]';
$recipient = '[email protected]';

$subject = "Virat Kohali";
$message = "indian team i love you";
$headers = 'From:' . $sender;

if (mail($recipient, $subject, $message, $headers))
{
    echo "Message accepted";
}
else
{
    echo "Error: Message not accepted";
}
?>

First check if PHP-scripts can send emails

php -a
mail ('[email protected]', "Virat Kohali", "indian team i love you");
exit ();

testmail.php

<?php
    mail ('[email protected]', "Virat Kohali", "indian team i love you");
?>

Web Programming Tutorials Example with Demo

Read :

Read Also:  Simple VueJS Array Mutate Example with Demo

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

Download

I hope you get an idea about How to check if PHP mail() is enabled?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.