Namespace or type 'mail' for the Imports 'System.Web.mail' cannot be found
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.
- Open the Solution Explorer.
- Right click "References" and select "Add Reference..."
- 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".
- 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: Brian Cryer 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.