Because System.Web.Mail is one of the namespaces not pre-referenced when you create a new project.
In your project, right-click references->Add Reference and locate System.Web.dll.
Double-click or click and Select to add the reference to your project.
If you are not using Visual Studio, add /r:System.Web.dll when compiling your code.