SmtpClient Constructor (String)

 

Initializes a new instance of the SmtpClient class that sends e-mail by using the specified SMTP server.

Namespace:   System.Net.Mail
Assembly:  System (in System.dll)

Public Sub New (
	host As String
)

Parameters

host
Type: System.String

A String that contains the name or IP address of the host computer used for SMTP transactions.

The host parameter is used to initialize the value of the Host property. The Credentials and Port properties are initialized by using the settings in the application or machine configuration files. If host is null or equal to String.Empty, Host is initialized using the settings in the application or machine configuration files.

For more information about using the application and machine configuration files, see <mailSettings> Element (Network Settings). If information is specified using SmtpClient constructors or properties, this information overrides the configuration file settings.

The following code example demonstrates calling this constructor.

No code example is currently available or this language may not be supported.

SmtpPermission

to construct an SmtpClient. Associated enumeration: SmtpAccess.Connect.

.NET Framework
Available since 2.0
Return to top
Show: