Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

Don't Catch a Virus from Your Web Page

Prevent Spam and Viruses That Come from Your Site

By Jennifer Kyrnin, About.com

Now, you wouldn't think that a virus would be something that a Web developer would be particularly worried about - other than protecting the computer you work on. But the reality is that the virus writers are getting smarter, and it's getting harder to hide from them.

The SirCam virus actually searches cached Web pages for email addresses. And since it has a mail server inside of it, it just uses those email addresses just like the most annoying email spammers. Only what it's sending is a virus, and not just an annoying ad.

How You Can Protect Yourself

  • Add "anti-spam" messages to your email address
    These are messages that a person would be able to strip out, but a spambot or virus wouldn't recognize.

  • Take your email address off of your Web pages
    Instead, use a feedback form where the email address is embedded in the CGI, not the HTML. The CGI will not be cached, and so you'll still get the comments, but hopefully fewer viruses and spam.

  • Convert your email address to an image
    Images are not cached in a way that spammer programs and viruses can grab the email address. Just make sure that your alt text doesn't include your email address.

  • Use JavaScript to build your mailto field
    Using a JavaScript "document.write" with variables that have split up your email address can build a mailto link that spambots can't read

Anti-Spam Messages in the Email Address

Anti-spam messages are probably the easiest way to help prevent spam and viruses from being spread. Simply add words that a person would recognize should be removed to your email address in the mailto field. For example:

webdesign*DELETETHISPART*.guide@about.com

The drawback to this method is that people don't often pay attention to email addresses when they are clicking on a mailto link. And, chances are, if they get a bounce back message, they won't notice why, they'll just delete the mail. I can speak from personal experience. I often write to one of my friends and forget to remove the _DELETE_ME_ from his email address.

Remove the Email Address

Removing your email address completely is probably the most effective method. You simply create a Web form, and use a CGI to send the mail. There are lots of form to email CGIs available on my Free CGIs listing page. Remember, you need to find one that stores the email address in the CGI itself. If it's in the HTML, a spambot or virus can get the email address.

One drawback to forms is that people don't like to use them. They feel more impersonal and so many customers who might otherwise have told you about that broken link will think twice before filling out a form.

Convert Email Addresses to Images

If you're good with graphics, you can do this yourself. But if you're not, the Email Guide has a review of a product that will do it for you.

MailMask for Windows
A free Windows tool to convert your email address on Web sites to an image to hide it from spammers.

The drawback to writing your email as an image is that you can't use it in a mailto tag. Also, your customers have to write the email address themselves, and that will cause typographical errors.

JavaScript to Hide Email Addresses

Using JavaScript to build your email address is a very effective way to hide your email address from spambots and viruses, but allow your customers the convenience of a mailto link. The About Email Guide also has a link to a tool that will build the JavaScript for you, so you don't have to.

Anti-Spam Script Maker
A free Windows tool to convert your email addresses to something spammers won't recognize.

The main drawback to using JavaScript is that some people surf with JavaScript turned off for security reasons. For these people, the mailto link will not work at all.

One Final Note

If you don't yet have antivirus software, I strongly recommend you get one. There are lots of tools to choose from. I use Norton Antivirus. And if you do have antivirus software, update your virus definitions often. This will both protect your computer and your data, as well as keep you from annoying your friends with the SirCam, Magistr, and other worms that mail themselves to everyone in your mailbox (including me <grin>).

Previous Features

Explore Web Design / HTML

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. Web Server Management
  5. Security
  6. Don't Catch a Virus from Your Web Page

©2009 About.com, a part of The New York Times Company.

All rights reserved.