Export (0) Print
Expand All

<network> Element (Network Settings)

Configures the network options for an external Simple Mail Transport Protocol (SMTP) server.

<configuration> Element
  <system.net> Element (Network Settings)
    <mailSettings> Element (Network Settings)
      <smtp> Element (Network Settings)
        <network> Element (Network Settings)
<network 
  host="host name"  
  port="integer"  
  defaultCredentials="true|false" 
userName="string" 
password="string" 
/>

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

defaultCredentials

Specifies whether the default network credentials on this host should be used for SMTP transactions.

host

Specifies the host used for SMTP transactions.

password

Specifies the password part of authentication to the SMTP host.

port

Specifies the port number used for SMTP transactions.

targetName

Specifies the Service Provider Name (SPN) to use for authentication when using extended protection for SMTP transactions.

userName

Specifies the user name part of authentication to the SMTP host.

Child Elements

None.

Parent Elements

Element

Description

<smtp>

Configures Simple Mail Transport Protocol (SMTP) mail sending options.

Some SMTP servers require that you authenticate yourself to the server before use. If you want to authenticate yourself using the default network credentials on your host, set the defaultCredentials attribute to true.

You can also use basic authentication (a user name and password) to authenticate yourself to the SMTP server. To use this option, you must specify a valid user name and password for the specified SMTP server.

NoteNote:

Basic authentication sends the userName and password values to the server unencrypted. Anyone monitoring network traffic can view your credentials and use them to connect to the server. You should consider using a more secure authentication mechanism, such as Kerberos or NT LAN Manager (NTLM.) If defaultCredentials is true, Kerberos or NTLM will be used if the server supports these protocols.

The basic authentication and default network credentials options are mutually exclusive; if you set defaultCredentials to true and specify a user name and password, the default network credential is used, and the basic authentication data is ignored.

If you specify a userName, you should also specify a password.

The following code example specifies the appropriate SMTP parameters to send e-mail using the default network credentials.

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="network">
        <network
          host="localhost"
          port="25"
          defaultCredentials="true"
        />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

Community Additions

ADD
Show:
© 2014 Microsoft