Solved

Check e-mail address?

Posted on 2004-04-22
6
136 Views
Last Modified: 2010-05-02
Hi all
Does anyone has a function/sub in VB to check an email address is good or bad?

Thanks.
0
Comment
Question by:melodiesoflife
6 Comments
 
LVL 18

Accepted Solution

by:
Sethi earned 100 total points
ID: 10887757
0
 
LVL 5

Expert Comment

by:Xentor_
ID: 10887758
If you're looking to verify if it's in the traditional user@dom.ain format, that's easy enough... But if you want to know if it's an actual working address, you'll have to actually send something to it.

To verify the format, I would do an Instr search to find the @, iterate through the part before it to check for alphanumeric only, then split the other part by periods (.) and check for alphanumerics and dashes surrounded by alphanumerics.
0
 
LVL 5

Expert Comment

by:Xentor_
ID: 10887769
Hmm, looking at Sethi's comment, it's nice to be proven wrong.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10887841
YOu have to correct the sysntaxes:

function checkemail(strEmail) as boolean
    If Len(strEMail) < 5 Exit function                              ' Minimum length check
    If InStr(strMail, "@", 1) = 1 Exit function                  ' Must contain @ symbol
    If InStr(strMail, ".", 1) = 1 Exit function                    ' Must contain . symbol

    checkemail = true
end function
0
 
LVL 6

Author Comment

by:melodiesoflife
ID: 10895742
Thank all.

I have wrote it for myself
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now