<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ReadMe</title>
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<meta content="Microsoft FrontPage 5.0" name="GENERATOR">
<meta content="FrontPage.Editor.Document" name="ProgId">
<meta content="Microsoft Visual Studio.NET 7.0" name="Originator">
</head>
<body>
<h1>
.NET Framework: Send Email</h1>
<p>This sample shows how to send email over SMTP using classes in the
System.Web.Mail namespace.
</p>
<h2>Featured Highlights:</h2>
<UL>
<LI>
This application has a single Windows Form with controls similar to the
Microsoft Outlook email client.
<LI>
When the Form loads it checks to make sure the user has the SMTP Service
installed on their machine and that it is running.
<LI>
Simple validation is performed on the "To" and "From" email address fields,
with the errors displayed using an ErrorProvider control.</LI></UL>
<H2>Requirements:</H2>
<P><STRONG>1.</STRONG> SMTP Service must be installed and running. SMTP is an
option installed with IIS.</P>
<P><STRONG>2. </STRONG>To send mail the SmtpServer property must be set to the IP
address or server name where the SMTP Server is running. In most cases this is
the "localhost" machine. As such, the SmtpServer property value can either be
the friendly name, "localhost", or "127.0.0.1". The latter is the default for
this application. If you have any trouble sending mail, check to make sure the
SmtpServer property is properly set in the code.</P>
<P>To find the SMTP server name, do the following:
</P>
<P>a) Open the IIS snap-in (Start | Control Panel | Administrative Tools | Internet
Information Services). (Note: On Win2K this is the Internet Services Manager)
</P>
<P>b) Expand the Default SMTP Virtual Server node (the exact name of this node may
vary by operating system).
</P>
<P>c) Click Domains. In the right pane you will see a list of Domain Names. You may
set the SmtpServer property to one of these names or their corresponding IP
addresses.
</P>
<P><STRONG>3. </STRONG>The Default SMTP Virtual Server must also be running.
Realize that it is possible for the SMTP Service to be running, but the Default
SMTP Server in IIS to be stopped. There is a difference between the service
itself and the actual server run by the service. It is akin to having IIS
running with a particular Web or FTP site stopped. IIS, the service, is still
running. But the particular Web or FTP site is not.
</P>
<P>If your Default SMTP Virtual Server is not running, a red X icon will be visible
over its node in the IIS snap-in. To start the Server, right-click its node and
select Start.
</P>
<P><STRONG>4. </STRONG>Finally, the Relay Restrictions must be properly set. To do
this:
</P>
<P>a) In IIS, right-click Default SMTP Virtual Server and select Properties.
</P>
<P>b) In the Properties dialog click the Access tab.
</P>
<P>c) Click Relay.
</P>
<P>d) In the Relay Restrictions dialog, check "All except the list below". The
bottom checkbox can be left checked or unchecked.
</P>
<P>e) Click OK twice to effect the change and clear the properties dialogs.</P>
<h2>Running the Sample:</h2>
<P>There are no special instructions for running the sample other than those listed
in the Requirements section.</P>
<h3>See also</h3>
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebMail.asp">
System.Web.Mail Namespace</a>
</body>
</html>