CFLib.org – Common Function Library Project

EmailAntiSpam(EmailAddress[, Mailto])

Last updated May 2, 2002

author

Seth Duffey

Version: 2 | Requires: CF5 | Library: StrLib

Description:
When given an email address this function will return the address in a format safe from email harvesters.

Return Values:
Returns a string

Example:

<CFOUTPUT>
#EmailAntiSpam("sduffey@ci.davis.ca.us")#<BR>
#EmailAntiSpam("sduffey@ci.davis.ca.us", "Yes")#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
EmailAddress Email address you want to make safe. Yes
Mailto Boolean (Yes/No). Indicates whether to return formatted email address as a mailto link. Default is No. No

Full UDF Source:

/**
 * When given an email address this function will return the address in a format safe from email harvesters.
 * Minor edit by Rob Brooks-Bilson (rbils@amkor.com)
 * Update now converts all characters in the email address to unicode, not just the @ symbol. (by author)
 * 
 * @param EmailAddress 	 Email address you want to make safe. (Required)
 * @param Mailto 	 Boolean (Yes/No). Indicates whether to return formatted email address as a mailto link.  Default is No. (Optional)
 * @return Returns a string 
 * @author Seth Duffey (sduffey@ci.davis.ca.us) 
 * @version 2, May 2, 2002 
 */
function EmailAntiSpam(EmailAddress) {
	var i = 1;
	var antiSpam = "";
	for (i=1; i LTE len(EmailAddress); i=i+1) {
		antiSpam = antiSpam & "&##" & asc(mid(EmailAddress,i,1)) & ";";
	}
	if ((ArrayLen(Arguments) eq 2) AND (Arguments[2] is "Yes")) return "<a href=" & "mailto:" & antiSpam & ">" & antiSpam & "</a>"; 
	else return antiSpam;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson