What are the best practices for handling IDN-encoded email addresses in PHP email scripts?

When handling IDN-encoded email addresses in PHP email scripts, it is important to convert the address to its Punycode representation before using it in email headers. This ensures that the address is properly encoded and can be correctly processed by email clients. One way to achieve this is by using the `idn_to_ascii()` function in PHP.

$email = '例@例子.com'; // IDN-encoded email address
$ascii_email = idn_to_ascii($email); // Convert to Punycode representation

// Use $ascii_email in email headers