Protect Your Email from Spammers!
One way the spammers got email addresses is, they collect email addresses from web pages. They use robots that crawl web pages and find any text like 'name@domain'.
To combat this email collector robots, make some small modifications to the emails you want to display. This will make the robots difficult to recognize your email addresses, but still readable by humans. For example, if your email is rahma.sarita@gmail.com, you might want to display it like this:
rahma.sarita @ gmail.com
rahma.sarita [at] gmail.com
rahma [dot] sarita [at] gmail [dot] com
rahma.sarixx@gmail.com
Here's the code:
<?php $email = "rahma.sarita@gmail.com"; /* sample 1 */ $e1 = preg_replace("/@/", " @ ", $email); /* sample 2 */ $e2 = preg_replace("/@/", " [at] ", $email); /* sample 3 */ $e3 = preg_replace("/@/", " [at] ", $email); $e3 = preg_replace("/\./", " [dot] ", $e3); /* sample 4 */ list($u, $h) = explode("@", $email); $e4 = substr($u, 0, strlen($u)-2) . "xx@$h"; print "$email<br>"; /* rahma.sarita@gmail.com */ print "$e1<br>"; /* rahma.sarita @ gmail.com */ print "$e2<br>"; /* rahma.sarita [at] gmail.com */ print "$e3<br>"; /* rahma [dot] sarita [at] gmail [dot] com */ print "$e4<br>"; /* rahma.sarixx@gmail.com */ ?>
Note that even this trick is useless if your mailto link still point to the original email address. Link to the modified one. Relax, a few lines of javascript will solve all problems.
Send your email to: <a href="javascript:mailto('rahma.sarita [at] gmail.com')"> rahma.sarita [at] gmail.com </a> <script language="javascript"> function mailto(e) { e = e.replace(/ /g, ""); e = e.replace(/\[at\]/, "@"); e = e.replace(/\[dot\]/g, "."); document.location.href = "mailto:" + e; } </script>
See, the javascript code above will 'fix' the email address and open up the user's email client program. Now for some demos:
Send your email to:
nashruddin.amin @ gmail.com
nashruddin.amin [at] gmail.com
nashruddin [dot] amin [at] gmail [dot] com
Done. This trick will save you from those spammers, at least the stupid one. :)
Keywords: email obfuscating, email obfuscator, email spamming, php, javascript
Share:
Save to del.icio.us
Digg this!

Add your comment
too difficult to understand
give me your private number please
-------
heri
Ow, Is it too difficult?
Sorry I cannot post my private number here. Contact me [at] nashruddin.com.
Nice idea, but what if user hasn't JS enabled ?
Then the user has to manually open the email program