Email address FormatException

M

Marcus Michaels

Hi folks,

I am recently experiencing an issue, where correctly formatted email
addresses can not be passed to the MailAddress constructor.

I use a string variable to assign he address and the code breaks with a
FormatException thrown.

I saw other posts referring to issues in the web.config, but I have no issues.
Most addresses are fine, but the ones throwing an exception can be added as
text directly and worj fine.

A sample

dim e as string
e="(e-mail address removed)"

Dim objMail As MailMessage = New MailMessage
objMail.To.Add(e)

the statemet above fires the error.

Dim objMail As MailMessage = New MailMessage
objMail.To.Add("(e-mail address removed)")

works perfectly though.

Any hints???

Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top