What parameters can be specified in the mail() function to ensure successful email delivery?

When using the mail() function in PHP to send emails, it's important to specify certain parameters to ensure successful delivery. One key parameter to include is the "From" header, which specifies the sender's email address. Additionally, setting the "Return-Path" header can help in case the email bounces back. Including a subject line and message body are also essential for the email to be properly formatted and delivered.

$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com\r\n";
$headers .= "Return-Path: sender@example.com\r\n";

mail($to, $subject, $message, $headers);