मैं कोई I18N विशेषज्ञ नहीं हूं लेकिन मैं जांच करने और निम्नलिखित समाधान के साथ आने के लिए पर्याप्त चिंतित था।
समस्या अनिवार्य रूप से अंतर्राष्ट्रीय डोमेन नाम (आईडीएन) को मेल भेजने के लिए है, यानी गैर-ASCII वर्ण हैं। आईडीएन आजकल मान्य हैं लेकिन जावा सहित कई प्रणालियों द्वारा मान्यता प्राप्त नहीं है (और इसलिए कोल्डफ्यूजन, जो CFMAIL पता फ़ील्ड के लिए जावा सत्यापन का उपयोग करता है - इसलिए आप जो त्रुटि देख रहे हैं)।
एक आईडीएन को पहचानने के लिए सिस्टम को इसे Punycode नामक एएससीआईआई फॉर्म में परिवर्तित करने की आवश्यकता है। उदाहरण के लिए müller.orgxn--mller-kva.org
LibIdn करने के लिए परिवर्तित करने की आवश्यकता है एक OS जावा पुस्तकालय है कि यह कर देगा और निम्न कोड दिखाता है कि आप का उपयोग कर सीएफ अप करने के लिए यह हुक कर सकते हैं मार्क मंडेल के JavaLoader चिह्नित करें।
<cffunction name="convertIdnToAscii" returntype="string" output="false">
<cfargument name="domain" type="string" required="true">
<cfscript>
var local = {};
// these paths assume the JavaLoader folder and the libidn-1.22.jar are in the same folder as the cfm template.
local.javaLoaderPath = "javaLoader.JavaLoader";
local.idnLibPath = ExpandPath("libidn-1.22.jar");
// convert the IDN lib path to an array which is what JavaLoader expects
local.libPathArray = [ local.idnLibPath ];
//load the IDN Lib
loader = CreateObject("component",local.javaLoaderPath).init(local.libPathArray);
// create an instance of the IDN lib
local.idn = loader.create("gnu.inet.encoding.IDNA").init();
// convert the domain name
return local.idn.toASCII(arguments.domain);
</cfscript>
</cffunction>
<cffunction name="convertIdnAddress" returntype="string" output="false">
<cfargument name="address" type="string" required="true">
<cfscript>
var local = {};
local.domain = GetToken(arguments.address,2,"@");
local.converted = convertIdnToAscii(local.domain);
return Replace(arguments.address,local.domain,local.converted);
</cfscript>
</cffunction>
<!--- Loop over a list of addresses and convert them if necessary --->
<cfset processedAddresses = []>
<cfloop list="[email protected]äöü.test.com,[email protected]" index="address">
<cfif(NOT IsValid("email",address))>
<cfset address = convertIdnAddress(address)>
</cfif>
<cfmail server="0.0.0.0" from="[email protected]" to="#address#" subject="test">Message</cfmail>
<cfset ArrayAppend(processedAddresses,address)>
</cfloop>
<cfdump var="#processedAddresses#">
यह (एक न के बराबर mailserver करने के लिए) 2 ईमेल भेजेंगे और डंप परिवर्तित पते:
[email protected]
[email protected]
नोट्स:
- libidn जार फ़ाइल, डाउनलोड हो और टार निकालने और जावा निर्देशिका में यह पता लगाने के लिए
- उपर्युक्त मानते हैं कि libidn jar और JavaLoader पैकेज उसी फ़ोल्डर में स्थित हैं जैसे टेम्पलेट में सीएफ कोड
- उपर्युक्त CF8 और ऊपर काम करना चाहिए, हालांकि मैंने केवल CF9 पर इसका परीक्षण किया है।
- ध्यान रखें कि उन पते के लिए कोई त्रुटि प्रबंधन नहीं है जो आईडीएन युक्त अन्य कारणों से अमान्य हो सकती हैं।
सिंटैक्स ' टेस्ट 'मेरे लिए काम करता है जैसे' से 'और' से ' मूल्य क्या आप अपवाद.लॉग में कोड और संदेश प्रदान कर सकते हैं? –
orangepips
कोल्डफ्यूजन का कौन सा संस्करण? 9? –
@orangepips: क्या आप किसी भी मौके से रेलो का उपयोग कर रहे हैं? मुझे एसीएफ 8 और 9 पर ओपी के समान त्रुटि मिलती है, जिसकी उम्मीद है क्योंकि एसीएफ javax.mail.internet का उपयोग करता है। इंटरनेट एड्रेस पार्सर जो केवल आरएफसी 822 के अनुसार ASCII मानों को अनुमति देता है (http://tjordahl.blogspot.com/2006/ देखें 09/coldfusion-email-validation-isvalid.html) – CfSimplicity