Skip to main content

Protecting Your Public E-mail Address

If you want to protect a publicly displayed email address from being captured by an e-mail address harvester. To protect the email address, you can manage the email address which is only read by human being but not recognized as a standard e-mail address to a program. For I have a written a simple php function which convert special symbol in an email address with English words, making the e-mail address unrecognizable as such to an address harvester. So @ becomes at, _ becomes underscore, and – becomes dash.

  1. <?php
  2. function protectEmail($email){
  3. $search = array(“.”,“-“,“_”,“@”);
  4. $replace = array(” dot “, ” dash “, ” underscore “, ” at “);
  5. return str_replace($search, $replace, $email);
  6. }
  7. $email = “”;
  8. $protected_email = protectEmail($email);
  9. echo “Result Email: “.$protected_email;
  10. ?>

Result Email: web dot revisions at gmail dot com


PHPZAG.COM is a popular PHP tutorial blog that publishes useful tips and tutorials for PHP programmer. If you would like to be kept up to date with our posts, you can subscribe to our RSS Feed

Leave a Reply

Your email address will not be published. Required fields are marked *


Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!