如何向域名中带有变音符号的收件人发送电子邮件?
在我的应用程序中,我必须向域名中有变音符号的收件人发送电子邮件。 例子: “test@äöü.test.com”
我正在使用 cfmail 标签,但收到这样的错误: “标签邮件属性的定义无效” “无效的电子邮件地址定义 (test@äöü.test.com)”
有没有办法在 Coldfusion 中向此类收件人发送电子邮件?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
甚至还有一个更简单的解决方案!为什么不使用类中内置的 Oracle:
http://download .oracle.com/javase/6/docs/api/java/net/IDN.html#toUnicode(java.lang.String)
那么你只需要这样做(示例显示从 punycode 到 Unicode):
您无需下载任何东西!
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):
You don´t have to download anything!
我不是 I18N 专家,但我很感兴趣,进行了调查并提出了以下解决方案。
问题本质上是如何将邮件发送到国际化域名 (IDN),即包含非 ASCII 字符的邮件。 IDN 现在是有效的,但不能被包括 Java 在内的许多系统识别(因此 ColdFusion,它对 CFMAIL 地址字段使用 Java 验证 - 因此您看到的错误)。
为了使系统能够识别 IDN,需要将其转换为名为 Punycode 的 ASCII 形式。例如 müller.org 需要转换为 xn--mller-kva.org
LibIdn 是一个操作系统 java 库,可以执行此操作,以下代码显示了如何使用 Mark Mandel 的 JavaLoader。
这将发送 2 封电子邮件(到不存在的邮件服务器)并转储转换后的地址:
[电子邮件受保护]
[email protected]
注意:
I'm no I18N expert but I was intrigued enough to investigate and come up with the following solution.
The problem is essentially how to send mail to Internationalised Domain Names (IDN), i.e. those which contain non-ASCII characters. IDNs are valid nowadays but not recognized by many systems including Java (and therefore ColdFusion, which uses the Java validation for CFMAIL address fields - hence the error you're seeing).
For a system to recognise an IDN it needs to be converted to an ASCII form called Punycode. For example müller.org needs to be converted to xn--mller-kva.org
LibIdn is an OS java library that will do this and the following code shows how you can hook it up to CF using Mark Mandel's JavaLoader.
This will send 2 emails (to a non-existent mailserver) and dump the converted addresses:
[email protected]
[email protected]
Notes: