Configures mail sending options.
<mailSettings <smtp> … </smtp> /mailsettings>
The following sections describe attributes, child elements, and parent elements.
None.
Attribute
Description
<smtp> Element (Network Settings)
Configures Simple Mail Transport Protocol options.
Element
<system.Net> Element (Network Settings)
Contains settings that specify how the .NET Framework connects to the network.
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>
VB.NET:
Imports System.Net
Imports System.Net.Mail
Dim emailClient As New SmtpClient("Your.SMTP.Server")
Dim mycredentials As New NetworkCredential("Your_SMTP_Login", "Your_SMTP_Password")
emailClient.UseDefaultCredentials = False
emailClient.Credentials = mycredentials