SmtpClient.ClientCertificates 속성

정의

SSL(Secure Sockets Layer) 연결을 설정하는 데 사용할 인증서를 지정합니다.

public:
 property System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ ClientCertificates { System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ get(); };
public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get; }
member this.ClientCertificates : System.Security.Cryptography.X509Certificates.X509CertificateCollection
Public ReadOnly Property ClientCertificates As X509CertificateCollection

속성 값

X509CertificateCollection

하나 이상의 클라이언트 인증서가 들어 있는 X509CertificateCollection입니다. 기본값은 구성 파일의 메일 구성 특성에서 파생됩니다.

예제

다음 코드 예제에서는 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 email 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 email on the client's behalf.
    client.UseDefaultCredentials = true;
                client.EnableSsl = true;
    client.Send(message);
}

설명

클라이언트 인증서는 기본적으로 선택 사항입니다. 그러나 서버 구성을 사용하려면 클라이언트가 초기 연결 협상의 일부로 유효한 인증서를 제시해야 할 수 있습니다.

참고

프레임워크는 SSL 세션을 만들 때 캐시하고 가능한 경우 새 요청에 대해 캐시된 세션을 다시 사용하려고 시도합니다. SSL 세션을 다시 사용하려고 할 때 프레임워크는 첫 번째 요소 ClientCertificates (있는 경우)를 사용하거나 비어 있는 경우 ClientCertificates 익명 세션을 다시 사용하려고 합니다.

적용 대상

추가 정보