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

タイムアウト値 (ミリ秒) を指定する Int32。既定値は 100,000 ミリ秒 (100 秒) です。


既定では、Send メソッドを呼び出すと、その操作が完了するまでブロックされます。Timeout プロパティが正の値に設定されていて Send 操作が指定の時間内に完了できなかった場合は、SmtpClient クラスによって SmtpException 例外がスローされます。

public static void CreateTimeoutTestMessage(string server) { string to = "jane@contoso.com"; string from = "ben@contoso.com"; string subject = "Using the new SMTP client."; string body = @"Using this new feature, you can send an e-mail message from an application very easily."; MailMessage message = new MailMessage(from, to, subject, body); SmtpClient client = new SmtpClient(server); Console.WriteLine("Changing time out from {0} to 100.", client.Timeout); client.Timeout = 100; // Credentials are necessary if the server requires the client // to authenticate before it will send e-mail on the client's behalf. client.Credentials = CredentialCache.DefaultNetworkCredentials; 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.Timeout プロパティを検索する場合は、下記のリンクをクリックしてください。

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