如何使用域名中的变音符号向收件人发送电子邮件? [英] How to send email to recipient with umlauts in domain name?
问题描述
在我的应用程序中,我必须向域名中有变音符号的收件人发送电子邮件.例子:test@äöü.test.com"
In my app I have to send email to recipient who has umlauts in domain name. Example: "test@äöü.test.com"
我正在使用 cfmail 标签,我收到这样的错误:标签邮件的属性定义无效""无效的电子邮件地址定义 (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)"
有没有办法在coldfusion中向这些收件人发送电子邮件?
Is there any way to send email to such recipients in coldfusion?
推荐答案
还有更简单的解决方案!为什么不使用内置的 Oracles:http://download.oracle.com/javase/6/docs/api/java/net/IDN.html#toUnicode(java.lang.String)
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)
那么您只需要这样做(示例显示从 punycode 到 Unicode):
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#
您不必下载任何东西!
这篇关于如何使用域名中的变音符号向收件人发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!