0

I'm working on a website that has many business profiles with their contact information which also include email addresses. Obviously I don't want to output the plain email addresses in the source due to spam. Could do mrsmith[at]gmail.com or obfuscate with ASCII but these solutions aren't ideal, not 100% foolproof.

The profiles do have a contact form but I also need to show the email addresses.

What I want to do is encode the emails with PHP and then decode with JS and create the anchor link dynamically. So I need an algorithm that's the same in PHP an JS if there is any...

14
  • Why is there a need to display an obfuscated address? Commented Sep 29, 2010 at 13:52
  • I've rephrased my question slightly, should be clearer now Commented Sep 29, 2010 at 13:54
  • 1
    I'll try and rephrase my question then: If the mail address shown is obfuscated what good is it? Commented Sep 29, 2010 at 13:57
  • Another option would be using images. That will also work in browsers with Javascript disabled. Commented Sep 29, 2010 at 13:59
  • If you're going to show the email address, you have to show it. Ordinary people don't understand anti-spam obfuscation methods; only people like us do. If your server is going to handle sending mail, then there's no need to show the email address at all. Commented Sep 29, 2010 at 14:00

2 Answers 2

1

First, use SSL. Then use an AJAX request to get the Data (jQuery will help with the AJAX). Seperate it into two requests. ex for [email protected]:

One request that gives yummyfood.

Then have another request that gives mybusiness.com.

The last idea is to use recaptcha mailhide (by Google). It will secure your email addressed just fine if that is the approach you want to take.

Sign up to request clarification or add additional context in comments.

1 Comment

I rather just do something like "Are you human? type in 'yes'" than captcha, captcha is so user unfriendly...
0

I've now solved this with a form asking the user to fill in a value and submit it. If value i correct, show email address. Also set an 'isHuman' session parameter so others emails will just show by default.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.