What does the error message "mail() has been disabled for security reasons" indicate in PHP?

The error message "mail() has been disabled for security reasons" indicates that the mail function in PHP has been disabled on the server for security purposes. To solve this issue, you can either enable the mail function in the php.ini file or use a third-party email service like SMTP to send emails from your PHP script.

// Example of sending email using SMTP
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com";

// Send email using SMTP
ini_set("SMTP", "smtp.example.com");
ini_set("smtp_port", "587");

if (mail($to, $subject, $message, $headers)) {
    echo "Email sent successfully";
} else {
    echo "Email sending failed";
}