Hi, Terry,
Go ahead and try this one. It's probably easier to use a straight function than a CFC!
<cfscript>
/**
* Verifies the existence of an email address by checking the provided email address against the ValidateEmail web service.
*
* @param emailaddress string containing the email address to test
* @return boolean
*/
function verifyEmail( emailaddress )
{
var emailStatus = false;
var validationStatus = "";
var ws = createObject( "webservice", "http://www.webservicex.net/ValidateEmail.asmx?wsdl" );
validationStatus = ws.IsValidEmail( Email=#Trim(emailaddress)# );
if( Trim( validationStatus ) is "YES" )
{
emailStatus = true;
}
return emailStatus;
}
</cfscript>
You can just throw this one in your CFML page or any other way to include in your application that you want (<cfinclude template=""/>).
In your CFML page, you can just call the function (so long as you included the function in your code):
This is good to test (just see if it's working)
<cfouput>#verifyEmail( YOUR_EMAIL_VARIABLE )#</cfoutput>
If the function above is included, you could check for a good or bad email and then act on it:
<cfscript>
emailOk = verifyEmail( YOUR_EMAIL_VARIABLE );
</cfscript>
<cfif emailOk>
<!--- email is good, do your stuff --->
<cfelse>
<!--- email is bad, do your stuff --->
</cfif>
Let me know if you have any trouble with it!