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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.