Hi all, I have just created a simple function to remove characters that
may cause the cfmail tag to crash...
<cfcomponent>
<cffunction name="strip_email" output="false" access="public"
returntype="string">
<cfargument name="email" type="string" required="true">
<!--- remove void characters from email address --->
<cfset new_email = ReplaceNoCase(arguments.email, ",", ".",
"ALL")>
<cfset new_email = ReplaceNoCase(new_email, " ", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "(<)|(>)", "",
"ALL")>
<cfset new_email = REReplaceNoCase(new_email, "!", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "\?", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "\^", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "\$", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "%", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "&", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "\*", "", "ALL")>
<cfset new_email = REReplaceNoCase(new_email, "(\[)|(\])", "",
"ALL")>
<cfset new_email = REReplaceNoCase(new_email, "(\{)|(\})", "",
"ALL")>
<cfreturn new_email/>
</cffunction>
</cfcomponent>
Can anyone think of some obvious items I am missing with this?
I also use the following javascript when the form is submitted...
<script language="JavaScript" type="text/javascript">
function validateForm(passForm) {
if (passForm.email.value == "") {
alert ("Please enter a valid email address.");
passForm.email.focus();
return false;
}
if (passForm.email.value.indexOf('@',0) == -1 ||
passForm.email.value.indexOf('@',0) == 0 ||
passForm.email.value.indexOf('.',0) == -1) {
alert ("Please make sure your email address has
been entered in the correct format.");
passForm.email.select();
passForm.email.focus();
return false;
}
return true;
}
</script>
mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234952
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54