Hi,
I am having difficulties getting an email to send through Javamail when there is an apostrophe in the email. If one of the senders is e'mail@address for example the InternetAddress constructor will add an extra apostrophe to the email address and say Recipient Unknown and then throw an exception.
Code:
message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(toarray));Exception:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class com.sun.mail.smtp.SMTPAddressFailedException: 550 <e''mail@address.com>, Recipient unknown
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1141)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:536)
Debug Information:
DEBUG SMTP: Invalid Addresses
DEBUG SMTP: e''mail@address.com
DEBUG SMTP: Sending failed because of invalid destination addresses
Does anyone have any ideas on how I can get around this issue and allow apostrope's and perhaps other characters that should be allowed in email addresses?
Thanks
Alex