| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<smtp> Element (Network Settings) |
03/30/2017 |
.net-framework |
|
article |
|
|
220b0329-e384-4e0c-86b4-0945ad17efd9 |
13 |
mcleblanc |
markl |
markl |
<smtp> Element (Network Settings)
Configures the delivery format, delivery method, and from address for sending e-mails.
<configuration>
<system.net>
<mailSettings>
<smtp>
Syntax
<smtp
deliveryFormat="format"
deliveryMethod="method"
from="from address"
<specifiedPickupDirectory> … </ specifiedPickupDirectory >
<network> … </network>
/smtp> Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
| Attribute | Description |
|---|---|
deliveryFormat |
Specifies the delivery format for outgoing e-mails. Acceptable values are SevenBit and International. |
deliveryMethod |
Specifies the delivery method for e-mails. Acceptable values are network, pickupDirectoryFromIis, and specifiedPickupDirectory. |
from |
Specifies the from address for outgoing e-mails. |
Child Elements
| Attribute | Description |
|---|---|
specifiedPickupDirectory |
Configures the local directory for a Simple Mail Transport Protocol (SMTP) server. |
network |
Configures the network options for an external SMTP server. |
Parent Elements
| Element | Description |
|---|---|
| <mailSettings> Element (Network Settings) | Configures mail sending options. |
Example
The following example specifies the appropriate SMTP parameters to send e-mail using the default network credentials.
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network" deliveryFormat="SevenBit" from="ben@contoso.com">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration> See Also
xref:System.Net.Configuration.SmtpSection?displayProperty=nameWithType
xref:System.Net.Mail.SmtpClient?displayProperty=nameWithType
xref:System.Net.Mail.SmtpDeliveryFormat
xref:System.Net.Mail.SmtpDeliveryMethod
Network Settings Schema