Activate php mail function cpanel

To activate the PHP mail function in cPanel, you'll need to follow these steps:

Step 1: Check if PHP mail is disabled

Log in to your cPanel account and navigate to the "Software" section. Click on "Select PHP Version" and then click on the version of PHP you're currently using.

In the PHP configuration file, look for the "sendmail_path" directive. If it's set to "/usr/sbin/sendmail -t -i", then PHP mail is disabled.

Step 2: Enable PHP mail

To enable PHP mail, you'll need to update the "sendmail_path" directive in the PHP configuration file. You can do this by clicking on the "Edit" button next to the PHP version you're using.

In the "PHP Configuration Editor" page, scroll down to the "sendmail_path" directive and update it to "/usr/sbin/sendmail -t -i -f $PHP_SENDMAIL_FROM". This will enable PHP mail.

Step 3: Save changes

Click the "Save" button to save the changes to the PHP configuration file.

Step 4: Restart PHP

To apply the changes, you'll need to restart the PHP service. You can do this by clicking on the "Restart Service" button next to the PHP version you're using.

Step 5: Test PHP mail

To test PHP mail, you can use a simple PHP script like this:

<?php
mail('[email protected]', 'Subject', 'Hello, this is a test email!');
?>

Save this script as a PHP file (e.g., testmail.php) in your public_html directory. Then, access the script by visiting http://yourdomain.com/testmail.php in your web browser. If PHP mail is working correctly, you should receive an email at the recipient's address.

That's it! If you encounter any issues or errors, you can check the PHP error logs or contact your web hosting provider for assistance.