Step 1: Login to the cPanel. Go to File Manager. Create a file “test-email.php” under public_html.
Step 2: Open the file and add the test-email.php script as below and save the file.
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "emailtest@YOURDOMAIN";
$to = "YOUREMAILADDRESS";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>
Step 3: Go to the browser and enter yourdomainname/test-email.php. You will receive a message that “Test email sent”.
Step 4: Login to the “To email address” which is set in php mail script. Check your inbox to ensure it has been delivered.
Note: If you have a Virtual Private Server (VPS), you can check the script by executing the command:
php test-email.php
Comments
0 comments
Please sign in to leave a comment.