CFLib.org – Common Function Library Project

EmailAntiSpam(EmailAddress[, Mailto])

Last updated May 02, 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson