Email address FormatException

Discussion in 'ASP .Net' started by Marcus Michaels, Jul 26, 2010.

  1. 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=""

    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("")

    works perfectly though.

    Any hints???

    Marcus
     
    Marcus Michaels, Jul 26, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sbox
    Replies:
    2
    Views:
    15,417
    Ben Miller [MSFT]
    Feb 15, 2004
  2. Maria
    Replies:
    4
    Views:
    8,547
    Maria
    Apr 4, 2004
  3. RSH
    Replies:
    1
    Views:
    9,060
    velocitydev
    Mar 14, 2009
  4. Avi
    Replies:
    1
    Views:
    3,404
    pkumarra
    Nov 16, 2006
  5. Sachin K

    System.FormatException on Mobile Application

    Sachin K, Aug 1, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    167
    Sachin K
    Aug 1, 2003
Loading...

Share This Page