![]() |
James Thornton |
| Internet Business Consultant |
| Home | Blog | Bio | Projects | Contact | Latest Blog (new site): How to Get to Genius |
|---|
Graphic @ for Spam Prevention
Simply create some commercial "@" images using a graphics program such as Photoshop. Crop the image so that there isn't any extra whitespace around it. Use a font that is same size and color as your website's text, and make the background of the image transparent. You may want to create several versions of different font, size, or color. I save different versions using descriptive filenames, such as:
I create a symbolic link from my most frequently used version to a filename that is easier to type, such as [nsadmin@roam images]$ ln -s graphic@-arial-12px-000000.gif @.gif Here's the HTML needed to properly render the "@" image (I'll show you some functions in a second that makes this easy):
Since the As an aside, Bruce "Tog" Tognazzini, a Nielsen Norman Group partner, was using "AT" in place of the "@" character in his online e-mail address to prevent e-mail harvesters from detecting it. Awhile back, I sent him e-mail suggesting that he use a graphic "@" instead, and it looks like he adopted it: http://www.asktog.com/misc/mailer.html. To create e-mail hyperlinks that aren't as susceptible to harvesters, use a Graphic @ in conjunction with a Make things easy on yourself by writing some code to generate the links. This site runs on OpenACS so when I want to create an e-mail link, I write:
...to generate: Here's some example code (NOTE: the OpenACS example includes the Perl#!/usr/bin/perl -w
# jt_email.pl
# invocation: print jt_email(james, electricspeed.com);
sub jt_email {
return "<nobr><a
href=/email/redirect-mailto.pl?u=$_[0]&d=$_[1]>$_[0]<img
src=/images/@.gif align=absbottom border=0
alt=\"@\">$_[1]</a></nobr>";
}
OpenACS# jt_email.tcl
# invocation: <%= [jt_email james electricspeed.com] %>
proc jt_email { user domain } {
set ua [ns_set get [ns_conn headers] "User-Agent"]
set iframe_p 0
if {[regexp {MSIE (.+);} $ua match ie_version] &&
![string match "*Opera*" $ua]} {
# Opera usually handles the mailto redirect fine;
# however, Opera 6.x said invalid email address
# if you clicked the link twice; fixed by 7.0
if {5.0 <= $ie_version} {
# 3.0B2 supports iframes,
# but somehwhere around 5.5 the mailto redirect
# started opening blank windows
set iframe_p 1
}
} elseif {[regexp {Mozilla/(.+?)[a-zA-Z\s]} $ua match mozilla_version]} {
# Netscape 4.x handles it ok,
# but newer versions started opening blank windows
if {5.0 <= $mozilla_version} {
# 5.0 supports iframes
set iframe_p 1
}
}
if $iframe_p {
set iframe_html "
<iframe name=rm width=1 height=1 frameborder=0
scrolling=no style=\"visibility:hidden;\"></iframe>
"
set target_html "target=rm"
} else {
set iframe_html ""
set target_html ""
}
return "<nobr><a
href=\"/email/?u=$user&d=$domain\" $target_html>$user<img
src=\"/images/@.gif\" align=absmiddle border=0
alt=\"@\">$domain</a></nobr>
$iframe_html
"
}
PHP<?php
// jt_email.php
// invocation: print jt_email("james", "electricspeed.com");
function jt_email($user, $domain) {
return "<nobr><a
href=/email/redirect-mailto.php?u=$user&d=$domain>$user<img
src=/images/@.gif align=absbottom border=0
alt=\"@\">$domain</a></nobr>";
}
?>
ColdFusion<cfscript>
// jt_email.cfm
// invocation: #jt_email("james", "electricspeed.com")#
function jt_email (user, domain) {
return '<nobr><a
href=/email/redirect-mailto.cfm?u=#user#&d=#domain#>#user#<img
src=/images/@.gif align=absbottom border=0
alt="@">#domain#</a></nobr>';
}
</cfscript>
ASPNote: I don't normally write in ASP so there probably is a cleaner way to write this.<%
'jt_email.asp
'invocation: Response.write jt_email("james","electricspeed.com")
Function jt_email(user,domain)
jt_email = "<nobr><a " &_
"href=/email/redirect-mailto.asp?u=" & user & "&" & "d=" & domain & ">" & user &_
"<img src=""/images/@.gif"" align=absbottom border=0 alt=""@"">" & domain & "</a></nobr>"
End Function
%>
|
|
James Thornton, jamesthornton.com>Services: Web Development |
Electric Speed: Web Applications Developer |
Prevent e-mail from harvesting your e-mail addresses just to make your Gif email: STOP SPAM - Make Your Email Invisible to SPAMMERS
-- Vladimir Bosev, August 6, 2005