perlcraft
davisagli
#!/usr/bin/perl -wT
# E-mail Redirect (for protecting addresses from E-mail-Address-Collecting Bots)
# by David Glick [davisagli], 6/25/2001
# when given an e-mail address in the form "[user],[domain]",
# this script returns an HTTP redirect to "mailto:[user]@[domain]"
# This can be used to prevent spam-bots from finding e-mail
# addresses in HTML links; for example, instead of linking to
# "mailto:me@mydomain", you can link to "this_script.pl?me,mydomain"
# Comments/improvements welcome; I don't have much experience with CGI.
# Update 6/25/2001: The security risk that [bikeNomad] pointed out
# shouldn't be an issue now. Also implemented his other suggestions.
# Thanks much, bikeNomad!
use strict;
use warnings;
use CGI qw/:standard/;
$_ = param('keywords');
my ($user, $domain) = m{^([\w!$'*+-/=^.]+),([\w!$'*+-/=^.]+)$};
print redirect( -uri => "mailto:$user\@$domain" )
if defined($user) && defined($domain);