Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1228
  • Last Modified:

Obfuscate mailto: email address with CF?

I am creating a business directory, where each business has address, phone, web address and possibly email address, all stored in a mySQL database.

Is there any reliable way to hide or obfuscate the email address with ColdFusion, if I want to create a mailto: link for each business? In the past I have created a contact form with the business info passed in the url, but for this site I am considering a simple text link that says "email" as a mailto link.

Thing is, I dont want to give away the email addresses to spammers..
any suggestions?
0
MichaelEvangelista
Asked:
MichaelEvangelista
  • 4
  • 3
1 Solution
 
danrosenthalCommented:
Any mailto: link would give the user the email address. You may be able to hide in javascript, but it would still be attainable because it would be emailed fromt the client. The only way to hide the email address would be from a form that never displays the email address and emails on the server side after the user submits the form.
0
 
MichaelEvangelistaAuthor Commented:
>> The only way to hide the email address would be from a form that never displays the email address and emails on the server side after the user submits the form.

Thats what I have done up till now.
I suppose my thought on this thread was whether I could dynamically generate the javascript to scramble the address in the actual page code. ( I realize it would be visible in the email client when the mailto link is clicked )

I have used js pages that let me enter an email address, and then the page generates the scrambled code, which I paste into the page, in place of the standard mailto: link.

Can I do this on the fly with CF somehow?
0
 
danrosenthalCommented:
You could dynamically create it and just break it into 5 pieces for instance:

part1 = "something"
part2 = "msn"
part3 = "com"

and then build out the link in a JS function

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
danrosenthalCommented:
(5 pieces with the "@" and ".")
0
 
MichaelEvangelistaAuthor Commented:
Aha... yes this is what I was getting at.
Can you provide a sample of the JS?
I will gladly double the points on this thread.
0
 
danrosenthalCommented:
How about this?

<!--- CREATE a query to use --->
<CFSET myQuery = QueryNew("company, email")>
<CFSET newRow  = QueryAddRow(MyQuery, 1)>
<CFSET temp = QuerySetCell(myQuery, "company", "Microsoft", 1)>
<CFSET temp = QuerySetCell(myQuery, "email", "bill@microsoft.com", 1)>

<!--- REPLACE myquery.email with the email address you are using --->
<CFSET part1 = LISTFIRST(myquery.email,"@")>
<CFSET part3 = LISTLAST(myquery.email,".")>
<CFSET part2 = REREPLACE(LISTLAST(myquery.email,"@"),part3,"")>

<CFOUTPUT>
<SCRIPT language="JavaScript">
function sendit(){
      part1 = '#part1#';
      part2 = '#part2#';
      part3 = '#part3#';
      email = part1 + "@" + part2 + part3;
      linkto = "mai"+"lto:" + email;
      window.location = linkto;
}
</script>

<A href="javascript:void(0);" onclick="sendit();">Send email!</a>
</cfoutput>
0
 
MichaelEvangelistaAuthor Commented:
Looks great - thanks Dan!
Haven't tested it yet but looking at the code, I bet it is just the thing.
( and  a reminder for me to brush up on listFirst / listLast )

Points increased and awarded!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now