What are common configuration errors in Sendmail that could lead to email content being distorted?

Common configuration errors in Sendmail that could lead to email content being distorted include incorrect line endings in the email message, improper encoding of special characters, and misconfigured headers. To solve this issue, make sure to use the correct line endings (\r\n), properly encode special characters using base64 or quoted-printable encoding, and ensure that the headers are correctly formatted.

// Set the correct line endings
$message = str_replace("\n.", "\n..", $message);
$message = str_replace("\n", "\r\n", $message);

// Encode special characters using base64
$message = base64_encode($message);

// Set the correct headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";