Solved

Obfuscate mailto: email  address with CF?

Posted on 2006-11-09
7
1,158 Views
Last Modified: 2013-12-24
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
Comment
Question by:MichaelEvangelista
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 17909893
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
 

Author Comment

by:MichaelEvangelista
ID: 17909999
>> 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
 
LVL 15

Expert Comment

by:danrosenthal
ID: 17910143
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 15

Expert Comment

by:danrosenthal
ID: 17910145
(5 pieces with the "@" and ".")
0
 

Author Comment

by:MichaelEvangelista
ID: 17910179
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
 
LVL 15

Accepted Solution

by:
danrosenthal earned 500 total points
ID: 17910304
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
 

Author Comment

by:MichaelEvangelista
ID: 17911249
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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now