Can you guys post methods of e-mail link spam-protection (in php or javascript)?
Basically I want to put a "mailto" link on a web page, like
<a href="mailto:[email protected]">E-mail me</a>
but I don't want the spam bots to pick it up and then spam me with penis enlargement emails :)
So far, I found a javascript obfuscator here: http://www.jottings.com/obfuscator/ Not sure how effective it is though..
Encryption is the most effective way to protect your data from unauthorized access. Encryption can be defined as transforming the data into an alternative format that can only be read by a person with access to a decryption key.
JavaScript Solution
With JavaScript you can do the following.
emailE = ('yourname@' + 'emailserver.com')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
With this, Crawlers can no longer read your email from source code.
PHP solution
With php you can convert your email to unicode values
function converte($email) {
$p = str_split(trim($email));
$new_mail = '';
foreach ($p as $val) {
$new_mail .= '&#'.ord($val).';';
}
return $new_mail;
}
and on your page use the function like
<?php echo converte('[email protected]'); ?>
Source code output will be something like
mail.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With