Encoding Email to Help Prevent Spam - Web Center

Use our Email Encoder to encode email addresses for placement on your website (this is optional for website maintainers at Ohlone College).

Spam[1] is unsolicited email - unwanted email that is not requested by the recipient.

Websites are commonly scanned by robot programs that harvest email addresses so that spam can be sent to them. A number of techniques are being used to prevent email addresses from being harvested.

Information about what to do and what not to do about spam can be found at spam.abuse.net.

Encoding your email address into special values called character entities which represent each character is one method. Javascript programs have been written that will convert an email address to its encoded value. You will then copy and paste the encoded email address after the "mailto:" part of the link. For example, this is an encoded link for Ohlone's webmaster email account (extra line breaks have been placed in the code so the width of the page is not broken - make sure the encoded parts you use are all on one line in your web page):

<a href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;
&#101;&#114;&#064;&#111;&#104;&#108;&#111;&#110;&#101;
&#046;&#099;&#099;&#046;&#099;&#097;&#046;&#117;&#115;">
&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;
&#111;&#104;&#108;&#111;&#110;&#101;&#046;&#099;&#099;&#046;
&#099;&#097;&#046;&#117;&#115;</a>

There is no guarantee, however, that encoding your email address will prevent spam. Robots can be created that are smart enough to decode the encoded address.

Online Tools to Encode Your Email Address

  • Ohlone's Email Encoder (online tool) - used with written permission from West Bay Web
  • West Bay Web - Email Encoder (online tool) - "This form will allow you to encode your email address through the use of Character Entities, transforming your ascii email address into its equivalent decimal entity. Simply enter your regular email address in the first text box, click the encode button, and then highlight and copy the resulting code produced in the second text box. This encoded email address can be read and translated back into its original ascii text by almost any web browser without any further action on your part. Just replace all instances of your email address on your pages with the code, and you won't have to worry about spam lists."
  • mailto Encoder (online tool) - "The HTML Encoder is a service of SiteUp Networks. The Encoder will format your email address in a way that IS NOT readable by any email extractor or search engine. The Encoder is only provided as a way to prevent HTML email harvesters from getting your address from your web pages. If you do not have a web site, the Encoder will not be useful to you."

Other Methods of Preventing Spam

The formmail script implemented on the Ohlone College website uses email aliases for the "recipient" <input> form field instead of the actual email address. Using aliases prevents the actual email addresses from being harvested. There is no way for a harvester program to get the email address from the CGI script.

Some people have resorted to using the illegal formats for their email address to try to prevent spam harvesting. These methods put a burden on the person using the email address to recognize that the address is invalid and to manually correct it before sending their message.

  • username @ yourdomain.com (before the message is sent, " @ " must be changed to "@"; i.e., no spaces surrounding @)
  • username AT yourdomain.com (before the message is sent, " AT " must be changed to "@")
  • username AT yourdomain dot com (before the message is sent, " AT " and " dot " must be changed to "@" and ".")
  • username @ yourdomain dot com (before the message is sent, " @ " and " dot " must be changed to "@" and ".")
  • username@yourdomain dot com (before the message is sent, " dot " must be changed to ".")
  • username@NOSPAMyourdomain.com (before the message is sent, "NOSPAM" must be removed)

A Last Note About Spam

Email addresses are distributed in a variety of ways, including:

  • They commonly appear in the signature at the bottom of an email address.
  • They always appear in the From:, To: and Cc: lines of email messages.
  • They are commonly placed on business cards.
  • They are commonly harvested from online forums, message boards, and listservs (which is often against the policies of the forum/board/listserv).
  • They are collected at tradeshows and conferences.

Spam can result from any of these contacts.


[1] SPAM™ (in all uppercase letters) is the official, trademarked name of the meat product by Hormel. When referring to unsolicited email, the spelling should be lowercase or initial-capped (i.e., spam or Spam).