SmtpClient.EnableSsl プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SmtpClient.EnableSsl プロパティの意味・解説 

SmtpClient.EnableSsl プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

SmtpClient が、接続を暗号化するために SSL (Secure Sockets Layer) を使用するかどうかを指定します。

名前空間: System.Net.Mail
アセンブリ: System (system.dll 内)
構文構文

Dim instance As SmtpClient
Dim value As Boolean

value = instance.EnableSsl

instance.EnableSsl = value
public bool EnableSsl { get;
 set; }
/** @property */
public boolean get_EnableSsl ()

/** @property */
public void set_EnableSsl (boolean value)

プロパティ値
SmtpClient が SSL を使用する場合は true。それ以外の場合は false。既定値は false です。

解説解説

ClientCertificates を使用して、SSL 接続を確立するために使用する必要のあるクライアント証明書を指定できます。ServerCertificateValidationCallback を使用すると、SMTP サーバーによって指定された証明書を拒否できます。SecurityProtocol プロパティにより、使用する SSL プロトコルのバージョンを指定できます。

使用例使用例

SMTP サーバーとの SSL 接続を確立し、その接続を使用して電子メールを送信するコード例を次に示します。

public static void CreateTestMessage(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.EnableSsl = true;
    client.Send(message);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SmtpClient クラス
SmtpClient メンバ
System.Net.Mail 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

SmtpClient.EnableSsl プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SmtpClient.EnableSsl プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS