# ASP - Can't import Mail library

**URL:** <https://forum.kirupa.com/t/asp-cant-import-mail-library/230984>\
**Category:** programming\
**Created:** [June 30, 2007, 8:33pm UTC](https://forum.kirupa.com/t/asp-cant-import-mail-library/230984 "2007-06-30T20:33:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncanhall](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@duncanhall](https://forum.kirupa.com/u/duncanhall)\
**Post date:** [June 30, 2007, 8:33pm UTC](https://forum.kirupa.com/t/asp-cant-import-mail-library/230984/1 "2007-06-30T20:33:52Z")

</div>

So I’m making the switch from PHP and going right back to basics with [ASP.NET](http://ASP.NET) (C#). I have a suitably hefty text book, but I’m failing at the first example.

```auto

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net.Mail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    void Page_Load() {
        SmtpClient client = new SmtpClient();
        client.Host = "localhost";
        client.Port = 25;
        client.Send("noone@nothing.co.uk", "himself@duncanhall.net", "Email Subject", "This is a message"); 
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Send Mail</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Email sent!
    </div>
    </form>
</body>
</html>

```

Simply trying to send an email, but I get a compilation error with:

[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif]\*The type or namespace name ‘Mail’ does not exist in the class or namespace ‘[System.Net](http://System.Net)’ (are you missing an assembly reference?)

\*Any ideas? This seems so trivial.  
[/FONT]
