java - Illegal character In email address after removing whitespaces -
i taking in email address via edittext. got error saying address contained whitespaces, no problem. implemented address.removeall("\\s" , ""); , getting error
- 04-16 09:37:43.009: w/system.err(1632): javax.mail.internet.addressexception: illegal character in local name in string ``606#7f080011app:id/enteremail}''
here code capturing email , converting string.
edittext e = (edittext) findviewbyid(r.id.enteremail); string = e.tostring().replaceall("\\s", ""); on line use address , error:
msg.setrecipient(mimemessage.recipienttype.to, new internetaddress(to)); i have done research trying find if parsing issue or causing found nothing. know why getting error? in advance.
that's because you're converting edittext string instead of getting text , doing replaceall() on it.
simply replace this:
string = e.tostring().replaceall("\\s", ""); with this:
string = e.gettext().tostring().replaceall("\\s", "");
Comments
Post a Comment