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);

Comments

  1. Please use parsing before making Internet Addresses...

    InternetAddress[] address = InternetAddress.parse(TO,true);

    where TO contains the all receiver's mail address.

    ReplyDelete
  2. 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

Post a Comment

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI