5 Replies Latest reply on Sep 28, 2006 5:07 AM by Newsgroup_User

    Generate Dynamic Email Havesting Blocking Code

    Level 7
      Is there any way out there to encode email addresses dynamically to prevent
      email harvesting?

      My employer would like to to populate a list of employees with their email
      addresses dynamically and encrypt them so they cannot be harvested.

      Any ideas how?


        • 1. Re: Generate Dynamic Email Havesting Blocking Code
          murpg Level 1
          Use this

          <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 (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;
          }
          </cfscript>


          <CFOUTPUT>
          #EmailAntiSpam("sduffey@ci.davis.ca.us")#<BR>
          #EmailAntiSpam("sduffey@ci.davis.ca.us", "Yes")#<BR>
          </CFOUTPUT>
          • 2. Re: Generate Dynamic Email Havesting Blocking Code
            murpg Level 1
            Use this

            <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 (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;
            }
            </cfscript>


            <CFOUTPUT>
            #EmailAntiSpam("sduffey@ci.davis.ca.us")#<BR>
            #EmailAntiSpam("sduffey@ci.davis.ca.us", "Yes")#<BR>
            </CFOUTPUT>
            • 3. Re: Generate Dynamic Email Havesting Blocking Code
              Level 7
              That is sharp, but I need to display the persons name and link it to the
              email address.
              The same as this:
              <a href="mailto:me@me.com">me< /a>
              Can that be done with this?


              • 4. Re: Generate Dynamic Email Havesting Blocking Code
                murpg Level 1
                Of course it can. Just do this. <cfoutput><a href="mailto:#EmailAntiSpam("me@me.com")#">me< /a></cfoutput>

                The script needs to be at the top of the document or above the cfoutput block.
                • 5. Re: Generate Dynamic Email Havesting Blocking Code
                  Level 7
                  Thanks a ton. Worked like a charm!