• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Check e-mail address?

Hi all
Does anyone has a function/sub in VB to check an email address is good or bad?

1 Solution
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.
Hmm, looking at Sethi's comment, it's nice to be proven wrong.
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
melodiesoflifeAuthor Commented:
Thank all.

I have wrote it for myself
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now