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
This class is used for sending e-mails over the SMTP protocol.
This class provides methods for sending e-mails over the SMTP protocol. It exposes this
functionallity through the and
methods. The e-mail is sent over the
SMTP protocol using an SMTP server which address is defined in .
This example shows the typical usage of the SmtpMail class. 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);
}
}
Method
System.Void
The message to be sent by the Send method.
Sends a MailMessage which represents an e-mail over the SMTP protocol.
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);
}
}
1.0.5000.0
2.0.0.0
Method
System.Void
The sender of the e-mail. This will be shown in the From field of the e-mail.
The reciever of the e-mail. This will be shown in the To field of the e-mail
The subject of the e-mail.
The body of the e-mail.
A method that sends e-mail messages.
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.");
}
}
1.0.5000.0
2.0.0.0
Property
System.String
This property tells the Send methods which SMTP server they should use.
A string representing the SMTP server address that the e-mails should be sent through.
This property represents the address of the SMTP server that the Send methods should use
when sending e-mail messages. I the address is not set then the Send methods will try
to connect to the local machine and check if there is an SMTP server running there.
1.0.5000.0
2.0.0.0
System.Obsolete("The recommended alternative is System.Net.Mail.SmtpClient.")