Hassan Mokdad
Hassan Mokdad

Reputation: 5902

Creating a new MailAddress produces "The specified string is not in the form required for an e-mail address", although it is in the correct format

I am trying to create a new MailAddress, the email is coming from Request Parameters, that is: Request.Params("fromEmail"). It is actually being sent from an android device through an http request. When I try to create a new MailAddress from this email, I get the error "The specified string is not in the form required for an e-mail address". When trying to create it directly, that it ma=new MailAddress("[email protected]") using the same coming string, it works, but creating it using ma=new MailAddress(Convert.ToString(Request.Params("fromEmail")) produces the error. I suspect there are some special caharacters being sent and making the email format unrecognizable, how can this be fixed

Thanks

Upvotes: 1

Views: 1692

Answers (1)

jmoreno
jmoreno

Reputation: 13571

Either you have an encoding problem, or a non-printing character in the parameter.

Upvotes: 4

Related Questions