All*_*lan 9 java email dns jakarta-mail
现在允许使用具有特殊丹麦字符的域,例如æøå,但我不能强制java邮件接受此.
@Test()
public void testMailAddressWithDanishCharacters1() throws AddressException, UnsupportedEncodingException {
InternetAddress cAddress = new InternetAddress( "test@testæxample12345123.com", null, "utf-8" );
System.out.println( cAddress.toString() );
cAddress.validate();
}
@Test()
public void testMailAddressWithDanishCharacters2() throws AddressException, UnsupportedEncodingException {
InternetAddress cAddress = new InternetAddress( "test@testæxample12345123.com", false );
System.out.println( cAddress.toString() );
cAddress.validate();
}
@Test()
public void testMailAddressWithDanishCharacters3() throws AddressException, UnsupportedEncodingException {
InternetAddress cAddress = new InternetAddress( "test@testæxample12345123.com", true );
System.out.println( cAddress.toString() );
cAddress.validate();
}
Run Code Online (Sandbox Code Playgroud)
所有测试都在InternetAddress的构造函数或validate()方法中失败.如何在域中处理这些特殊的丹麦字符.我敢打赌其他国家/地区的域名与电子邮件在javamail InternetAddress中存在同样的问题.