Why do some email servers not send back a 'could not be delivered' email when the recipient does not exist?

Some email servers do not send back a 'could not be delivered' email when the recipient does not exist in order to prevent email harvesting and spamming. To solve this issue, you can implement email verification before sending the email to ensure that the recipient's email address is valid.

// Check if recipient email address is valid before sending email
$recipient_email = 'recipient@example.com';

if (filter_var($recipient_email, FILTER_VALIDATE_EMAIL)) {
    // Send email
    mail($recipient_email, 'Subject', 'Message');
} else {
    echo 'Invalid email address';
}