Skip to main content


ec_rfc2047_encode_addresses — create an RFC2047-compliant address


ec_rfc2047_encode_addresses { addresses }


ec_rfc2047_encode_addresses create an RFC2047-compliant address and is intended for use in mail generation. This function might be used in the following way. If you are generating email (perhaps via generate_mail_raw) and want to add a To: header of the form: To: "FirstName LastName" <> and FirstName and/or LastName may have non-ASCII characters, you can call ec_rfc2047_encode_addresses to correctly escape them, per RFC2047, so that they will be understood by MIME compliant software; you would pass the right hand side of the above to the action and it will parse out the address information and correctly compose it for you and return the result.

$to = "FirstName LastName "; $encoded = ec_rfc2047_encode_addresses $to; ...

You might use this function in one of the custom bounce generation hooks, or at any point after data (when you have a message).

Was this page helpful?