How can the crypt() function be used to encrypt email content in PHP?

To encrypt email content in PHP using the crypt() function, you can generate a random salt and use it to hash the email content. This will provide a basic level of encryption to protect the content from being easily readable.

$emailContent = "This is a confidential email content.";
$salt = uniqid(mt_rand(), true);
$encryptedContent = crypt($emailContent, $salt);

// Send the encrypted content via email