When we receive a MimeMessage
which contains recipient InternetAddresses
containing square brackets, we get 'javax.mail.internet.AddressException: Local address contains illegal character in string
' when we call MimeMessage.getAllRecipients()
.
The email address below is one example where we get the above exception:
"ABC NAME-DEM-SAST1" <ABCNAME-DEM-SAST1[001-SAST1@domain.com]>
Is the above example address an actual valid email address? And if it is, why can't an InternetAddress be created from it?
e.g. InternetAddress add = new InternetAddress("\"ABC NAME-DEM-SAST1\" <ABCNAME-DEM-SAST1[001-SAST1@domain.com]>"
, false);
I had a look at Javamail problem with ñ characters in mail addresses question for an answer but to no avail.
I am using javamail 1.4 and JVM is running on a Linux host system.
Any insight on this issue would be much appreciated!
Regards, PM.