Skip to main content

Protecting Your Public Email Address using PHP

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.

function protectEmail($email){
$search = array(“.”,“-“,“_”,“@”);
$replace = array(” dot “, ” dash “, ” underscore “, ” at “);
return str_replace($search, $replace, $email);
$email = “”;
$protected_email = protectEmail($email);
echo “Result Email: “.$protected_email;

Result Email: phpzag at gmail dot com



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!