[thelist] Preventing spam spiders from reading mailto links.

Daniel Schlyder daniel at bitblaze.com
Tue Dec 9 18:41:56 CST 2003


[09.12.2003 19:41:23] Paul Bennett:
> Daniel Schlyder wrote:

>>In your page:
>>
>><p><form method="post" action="mailto.php" style="display: inline">
>>   <input type="hidden" name="u" value="username" />
>>   <input type="hidden" name="d" value="domain" />
>>   <input type="image"
>>      src="email-image.php?u=username&amp;d=domain&amp;font=4"
>>      alt="username at domain"
>>      style="vertical-align: middle" />
>></form></p>
>>
>>
>>mailto.php:
>>
>><?php
>>
>>if (isset($_POST['u']))
>>{
>>    header('Location: mailto:' . $_POST['u'] . '@' . $_POST['d']);
>>}
>>
>>?>
>>
> forgive me if I've missed something, but if you're going through all 
> this trouble why not just use the php mail() function on this script?

Because then it would no longer be a mailto link. To a user, the above form
could be made to look more or less like a regular mailto link by applying CSS
to the graphical submit button and modifying the PHP script that generates the
image displaying the email address, and once clicked, it will open his or hers
email client, as you would expect.

Of course, if you want an address to be absolutely safe from spam, you'd just hide
it server-side, behind a contact form, and send the submitted data using mail().

Regards,
Daniel Schlyder



More information about the thelist mailing list