How to format an email address line (with name) with PHP?
- by nbr
I'm trying to generate email messages. The recipient's email address and name are specified by a user. What is the correct way to do this with PHP:
$to_header = "To: $name <$email>" # incorrect!
I already use a decent method for validating the email addressess (let's not go to that now...), but how do I properly encode $name with eg. QP…