javax.mail.internet.AddressException: Illegal semicolon, not in group in string
Problem:
javax.mail.internet.AddressException: Illegal semicolon, not in group in string
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:921)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633)
at example.Test2.processFolder(Test2.java:139)
at example.Test2.processFolder(Test2.java:64)
at example.Test2.processFolder(Test2.java:64)
at example.Test2.<init>(Test2.java:43)
at example.Test2.main(Test2.java:33)
Please give any solution.......
Solution: Please replace all semicolon with colon(,) and then try it.
String emailTO=email.getDisplayTo();
InternetAddress[] address_old = InternetAddress.parse(emailTO.replace(';' , ',') , true);
javax.mail.internet.AddressException: Illegal semicolon, not in group in string
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:921)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633)
at example.Test2.processFolder(Test2.java:139)
at example.Test2.processFolder(Test2.java:64)
at example.Test2.processFolder(Test2.java:64)
at example.Test2.<init>(Test2.java:43)
at example.Test2.main(Test2.java:33)
Please give any solution.......
Solution: Please replace all semicolon with colon(,) and then try it.
String emailTO=email.getDisplayTo();
InternetAddress[] address_old = InternetAddress.parse(emailTO.replace(';' , ',') , true);
Please use parsing before making Internet Addresses...
ReplyDeleteInternetAddress[] address = InternetAddress.parse(TO,true);
where TO contains the all receiver's mail address.
Semi-colons between email addresses is industry standard. The most widely used email program, MS Office uses semi-colons. Java programmers, go create an object that allows semi-colons and commas.
ReplyDelete