System.Web
1.0.5000.0
2.0.0.0
Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.
System.Object
The mail message can be delivered either through the SMTP mail service built into Microsoft Windows 2000 or through an arbitrary SMTP server. Types in the namespace can be used from ASP.NET or from any managed application.
If the property is not set, mail is by default queued on a Windows 2000 system, ensuring that the calling program does not block network traffic. If the property is set, the mail is delivered directly to the specified server.
Provides properties and methods for sending messages using the Collaboration Data Objects for Windows 2000 (CDOSYS) message component. Recommended alternative: .
Method
System.Void
This method sends an e-mail to the recipients specified in the parameter
. The e-mail is sent over the SMTP protocol through the server
specified in .
This example shows the typical usage of the SmtpMail.Send method. To run this sample you have to change the
e-mail addresses and the SMTP server to real ones.
using System;
using System.Web.Mail;
public class SmtpTest {
public static void Main (String[] args)
{
MailMessage message = new MailMessage();
message.From = "per@foo.bar";
message.To = "ola@foo.bar";
message.Subject = "Hello, E-Mail world!";
message.Body = "This is a test mail.";
SmtpMail.SmtpServer = "mail.foo.bar";
SmtpMail.Send (message);
}
}
Sends an e-mail message using arguments supplied in the properties of the class. Recommended alternative: .
The to send.
1.0.5000.0
2.0.0.0
Method
System.Void
This is a method that sends an e-mail message over the SMTP protocol. It connects
to the SMTP server as specified in and
sends the e-mail to . This method is a simplified version of
which is actually used by this
method for sending e-mails.
Here is a simple example to show how to send an e-mail.
using System;
using System.Web.Mail;
public class SmtpTest {
public static void Main (String[] args)
{
SmtpMail.SmtpServer = "mail.foo.bar";
SmtpMail.Send ("per@foo.bar","ola@foo.bar","Hello, E-Mail world!","This is a test mail.");
}
}
Sends an e-mail message using the specified destination parameters. Recommended alternative: .
The address of the e-mail sender.
The address of the e-mail recipient.
The subject line of the e-mail message.
The body of the e-mail message.
1.0.5000.0
2.0.0.0
Property
System.String
A string representing the SMTP server address that the e-mails should be sent through.
If your local SMTP server (included with Windows 2000 and Windows Server 2003) is behind a firewall that blocks any direct SMTP traffic (through port 25), you will need to find out if there is a smart host available on your network that is allowed to relay SMTP messages to the Internet.
A smart host is an SMTP server with the permissions to relay outgoing e-mail messages directly to the Internet from internal SMTP servers. A smart host should be able to simultaneously connect to both the internal network and the Internet in order to work as the e-mail gateway.
Gets or sets the name of the SMTP relay mail server to use to send e-mail messages. Recommended alternative: .
1.0.5000.0
2.0.0.0
System.Obsolete("The recommended alternative is System.Net.Mail.SmtpClient.")