EmailAntiSpam(EmailAddress [, Mailto])
Last updated May 2, 2002
Version: 2 | Requires: ColdFusion 5 | 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:
#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:
<cfscript>
/**
* 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 (rbils@amkor.comsduffey@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;
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)