SmtpClient.UseDefaultCredentials プロパティ
アセンブリ: System (system.dll 内)

Dim instance As SmtpClient Dim value As Boolean value = instance.UseDefaultCredentials instance.UseDefaultCredentials = value
/** @property */ public boolean get_UseDefaultCredentials () /** @property */ public void set_UseDefaultCredentials (boolean value)
public function get UseDefaultCredentials () : boolean public function set UseDefaultCredentials (value : boolean)
既定の資格情報が使用される場合は true。それ以外の場合は false。既定値は false です。


一部の SMTP サーバーでは、サーバーがクライアントに代わって電子メールを送信する前に、クライアントが認証されている必要があります。この SmtpClient オブジェクトを、現在ログオンしているユーザーの既定の資格情報を使用して認証する必要がある (サーバーから要求されている場合) ときは、このプロパティを true に設定します。クライアント アプリケーションでは、ほとんどの場合、この動作が必要です。
資格情報は、アプリケーションまたはコンピュータの構成ファイルを使用して指定することもできます。詳細については、「mailSettings 要素 (ネットワーク設定)」を参照してください。

public static void CreateTestMessage2(string server) { string to = "jane@contoso.com"; string from = "ben@contoso.com"; MailMessage message = new MailMessage(from, to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpClient client = new SmtpClient(server); // Credentials are necessary if the server requires the client // to authenticate before it will send e-mail on the client's behalf. client.UseDefaultCredentials = true; client.Send(message); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSmtpClient.UseDefaultCredentials プロパティを検索する場合は、下記のリンクをクリックしてください。

- SmtpClient.UseDefaultCredentials プロパティのページへのリンク