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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top