title: Type MailMessage is not defined
body: <p>Trying to get a simple mail script up and running in .NET. The problem is that I keep getting the error message <code>Type MailMessage is not defined</code>, but I have imported <code>System.Net.Mail</code> in the CodeFile. Below is my Default.aspx.vb.</p>
  
  <p>If I declare it like <code>&lt;%@ Import Namespace="System.Web.Mail"%&gt;</code> at the top of the file and don't use a MasterPage and CodeFile it works, but then I can't use MasterPage.</p>
  
  <p>I'm new at this. What am I missing?</p>
  
  <pre><code>Imports System.Data
  Imports System.Xml
  Imports System
  Imports System.Web
  Imports System.Net.Mail
  
  Partial Class _Default
  Inherits System.Web.UI.Page
  
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      If Me.IsPostBack = False Then
  
      End If
  End Sub
  
  End Class
  </code></pre>
  
  <p>Beginning of my mail script looks like this:</p>
  
  <pre><code>&lt;script runat="server"&gt;
      Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)   
  
  
      Dim myMail As New MailMessage()
  </code></pre>