Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verifying an Email Address

General

Verifying an Email Address

by  Glowball  Posted    (Edited  )
If you want to make sure an email address is valid you can use a Regular Expression to match the correct pattern. Email addresses used by
Code:
CFMAIL
must be valid for the email to go through. Use this block to check if an email address entered from a form is correct:
Code:
<cfif REFindNoCase("^(.+)@(.+)\.(.+)$", Trim(FORM.email))>
    <cfset theEmail = Trim(FORM.email)>
<cfelse>
    <!--- email is bad, set it to something else --->
</cfif>
Then you can use
Code:
VARIABLES.theEmail
and know that it is a correctly-formed email address. This only makes sure that it might be an email address, it does not guarantee that the email address actually works. That is up to luck and your mail server.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top