[Zope] Email Anti-spam solution

Bruce Eckel Bruce@EckelObjects.com
Sat, 01 Dec 2001 10:29:52 -0800


Here's the solution. Instead of using a mailto tag, put something
like this on your web page:

<FORM METHOD="POST" ACTION="/Util/send">
<INPUT TYPE="HIDDEN" NAME="name" VALUE="bruce">
<INPUT TYPE="HIDDEN" NAME="domain" VALUE="EckelObjects.com">
<INPUT TYPE="HIDDEN" NAME="subject" VALUE="Here is the subject
line">
<INPUT TYPE="SUBMIT" VALUE="Send Email to Bruce">
</FORM>

Add this in as the external method 'send' (which in my case is in
the /Util directory):

'''Send email via anti-spam mechanism'''

def send(self):
  mailto = 'mailto:%s@%s' % (self.REQUEST['name'],
self.REQUEST['domain'])
  if self.REQUEST['subject'] != '':
    mailto += '?Subject=%s' % self.REQUEST['subject']
  return self.REQUEST.RESPONSE.redirect(mailto)  

Voila! No more spambots collecting your address!

Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" & "Thinking
in C++ 2e"
Please subscribe to my free newsletter -- just send any email to:
join-eckel-oo-programming@earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================