954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Validating multiple email address by server side - asp.net

Hi,

I want the vb.net code(asp.net 2.0) for validating multiple email address in a textbox(multiline).

Life is the only God....OSHO

Thanx
- Anup

anup.maverick
Newbie Poster
16 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

I am a c# programmer I give some idea

01)get text box value to the string & split it to separate email address using split() function in string class
via spaces
eg-> [email]iamchamith@yahoo.com[/email] [space] [email]iamkasun@yahoo.com[/email]
arr[0] = [email]iamchamith@yahoo.com[/email]
arr[1] = [email]imakasun@yahoo.com[/email]

02)then get this values[each email addresses] to the array

03)now u can validate is each array(email address) correct using this method

04)In that case you check index of @ mark & . mark ...

05)Now You can validate it
[id index of @ small than index of . the email is correct]

Thanks

iamchamith
Junior Poster in Training
66 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

Yes you can follow the steps that iamchamith said. After getting individaul email then you can validate those from the following URL:

http://shawpnendu.blogspot.com/2009/04/cross-browser-javascript-aspnetc-email.html

This will just check the input format. If you are looking to test that email id really exist or not then you can try with VRFY(most mail server admin disables this feature for spammers) function of SMTP. For more details read rfc of SMTP.

mail2saion
Posting Whiz in Training
247 posts since Apr 2009
Reputation Points: 26
Solved Threads: 44
 

Try string.Split should work. If you want validate you can write a regex for the same. Thanks.

questpond
Newbie Poster
19 posts since Feb 2011
Reputation Points: 10
Solved Threads: 5
 
Private Function ValidateEmail(ByVal EmailAddress As String) As Boolean
        Try
            If EmailAddress.Trim.Length = 0 Then
                MsgBox("Please enter the email Address")
                Return False
            End If
            Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"

            Dim emailAddressMatch As Match = Regex.Match(EmailAddress, pattern)
            If emailAddressMatch.Success Then
                Return True
            Else
                MsgBox("Please enter the valid email address")
                Return False
            End If


        Catch ex As Exception

        End Try
    End Function


Pass each email adress from array to this function and it will return true or false

Pgmer
Master Poster
714 posts since Apr 2008
Reputation Points: 54
Solved Threads: 121
 

The question was he wants to read emails from multiline text box and not the email validation i think

questpond
Newbie Poster
19 posts since Feb 2011
Reputation Points: 10
Solved Threads: 5
 

But he has mentioned like
I want the vb.net code(asp.net 2.0) for validating multiple email address in a textbox(multiline).

Pgmer
Master Poster
714 posts since Apr 2008
Reputation Points: 54
Solved Threads: 121
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: