Search code examples
emailcoldfusioncfmail

How to send email to recipient with umlauts in domain name?


In my app I have to send email to recipient who has umlauts in domain name. Example: "test@äöü.test.com"

I'm using cfmail tag and I'm getting such error: "invalid definition for attribute to at tag mail" "Invalid E-Mail Address definition (test@äöü.test.com)"

Is there any way to send email to such recipients in coldfusion?


Solution

  • There is even a easier solution! Why not use Oracles built in class: http://download.oracle.com/javase/6/docs/api/java/net/IDN.html#toUnicode(java.lang.String)

    Then you only have to do this (example shows from punycode to Unicode):

    <cfset strUrl = "xn--land-poa.se" />
    
    <!--- Create a Java URL. --->
    <cfset jUrl = CreateObject( "java", "java.net.IDN" ).toUnicode(strUrl) />
    
    <cfoutput>
    #jUrl#
    

    You don´t have to download anything!