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

SMTP トランザクションで使用するコンピュータの名前または IP アドレスを格納している String。


Host プロパティの値は、コンストラクタを使用するか、アプリケーションまたはコンピュータの構成ファイルを使用して設定することもできます。詳細については、「mailSettings 要素 (ネットワーク設定)」を参照してください。

アプリケーションの構成ファイルで指定されたホストとポートを使用して、電子メール メッセージを送信するコード例を次に示します。
public static void CreateTestMessage4(string server) { MailAddress from = new MailAddress("ben@contoso.com"); MailAddress to = new MailAddress("Jane@contoso.com"); MailMessage message = new MailMessage(from, to); message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; SmtpClient client = new SmtpClient(server); Console.WriteLine("Sending an e-mail message to {0} by using SMTP host {1} port {2}.", to.ToString(), client.Host, client.Port); 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.Host プロパティを検索する場合は、下記のリンクをクリックしてください。

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