Cry about...
MS-Windows Troubleshooting

Namespace or type 'mail' for the Imports 'System.Web.mail' cannot be found


After adding:

Imports System.Web.mail

to a file (for example when wanting to the the MailMessage class), the following compiler error is generated:

Namespace or type 'mail' for the Imports 'System.Web.mail' cannot be found.


The application is lacking a reference to System.Web.dll, and hence the compiler does not know where to find System.Web.mail.


  1. Open the Solution Explorer.
  2. Right click "References" and select "Add Reference..."
  3. On the ".NET" tab, scroll down until you find "System.Web.dll". Select it and then click "Select". It will now be listed under "Selected Components".
  4. Click [OK]. The error should now disappear.

These notes have been tested with .Net 1.1 applications developed under Windows XP, and may apply to other versions as well.

About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.