A large number of webmasters use the cPanel server hosting service, which also includes wide use of different types of php scripts. PHP mail scripts are one of the most important scripts for a webmaster as the mail deliveries are completely depend on them. In this post, you can see how to check the php mail script is working fine or not on your web hosting server.
If your server is a cPanel server then make sure to enable all mails, you can check it from WHM > tweak settings.
Log in to cPanel and click on ‘File Manager’
Find the public_html directory which is normally found at ‘/home/username/public_html directory’
Create file with name testing.php
type the following script in testing.php
$to = “[email protected]”;
$subject = “Test mail”;
$message = “Hello! This is a simple email message.”;
$from = “[email protected]”;
$headers = “From: $from”;
echo “Mail Sent.”;
Change your email ID with [email protected]
As you are in a cPanel so you need to chant ownership to the user. user and permission to 644 but if you are not in cPanel then there is no need to make any changes in the permission.
Save the editions and exit
Now go to http://yourdomain/testing.php
If you received the mail at the given email ID after visiting the above link then your php mail script has no problem and working very well on the server.