配信方法および電子メールの差出人アドレスを設定します。
<smtp
deliveryMethod="method"
from="from address"
<specifiedPickupDirectory> … </ specifiedPickupDirectory >
<network> … </network>
/smtp>
属性および要素
以降のセクションでは、属性、子要素、および親要素について説明します。
属性
属性 |
説明 |
---|---|
deliveryMethod |
電子メールの配信方法を指定します。 指定できる値は、network、pickupDirectoryFromIis、および specifiedPickupDirectory です。 |
from |
電子メールの差出人アドレスを指定します。 |
子要素
要素 |
説明 |
---|---|
< specifiedPickupDirectory > |
SMTP (Simple Mail Transport Protocol) サーバー用のローカル ディレクトリを設定します。 |
外部 SMTP サーバー用のネットワーク オプションを設定します。 |
親要素
要素 |
説明 |
---|---|
電子メールの送信オプションを設定します。 |
使用例
既定のネットワーク資格情報を使用して電子メールを送信するために、適切な SMTP パラメーターを指定するコード例を次に示します。
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="ben@contoso.com">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>