Forum OpenACS Q&A: Redirect-mailto: Trick

Collapse
7: Redirect-mailto: Trick (response to 1)
Posted by James Thornton on
I came up with this "Redirect-mailto:" trick that reduces spam by separating e-mail addresses from Web pages while still providing a way for the user to click an e-mail address link and have it open their local mailer.

Mail link:

<a href=/email/james>james@jamesthornton.com</a>

File /email/james:

ns_returnredirect "mailto:james@jamesthornton.com"

Example: james@electricspeed.com

For extra protection, consider putting the /email path in your robots.txt file to exclude robots from crawling it and grabbing the output of the link. You could even include some code that compares the user agent to those listed in http://www.robotstxt.org/wc/active/all.txt, and if it is a robot, return nothing.

Even better, write a proc such as, [jt_email "james@jamesthornton.com"] or [ad_email $user_id] that compares the user agent to the list, and if it is a user agent, then don't return anything (not even the part between the closing and end anchor tag). I started writing this proc a while back, but I can't find -- if I find it, I'll post it.