By default the sendmail php function is disabled on hosting, to be able to send mail through hosting you can do the following
Access cPanel and navigate to “Select PHP Version”
After accessing "Select PHP Version" select "Switch to PHP Option" to switch to edit php configuration page
In the "sendmail_path" section, select "/ usr / sbin / sendmail -t" to be able to send mail from php.
After selecting the complete, the system will automatically save it, so you can send mail from the send mail php function