cosullivan / SmtpServer

A SMTP Server component written in C#
MIT License
675 stars 159 forks source link

Example missing method - CreateX509Certificate2 #203

Closed tinohager closed 8 months ago

tinohager commented 1 year ago

https://github.com/cosullivan/SmtpServer#what-hooks-are-provided

    .Certificate(CreateX509Certificate2())
tinohager commented 1 year ago

Also the Certificate method is wrong after Port it is ony available in the endpoint builder.

        var options = new SmtpServerOptionsBuilder()
            .ServerName("SMTP Server")
            .Endpoint(builder =>
                    builder
                        .Port(25, false)
                        .AllowUnsecureAuthentication(true))
            .Endpoint(builder =>
                    builder
                        .Port(587, true)
                        .AllowUnsecureAuthentication(false)
                        .Certificate(CreateCertificate()))
            .Endpoint(builder =>
                    builder
                        .Port(465, true)
                        .AllowUnsecureAuthentication(false)
                        .Certificate(CreateCertificate()))
            .Build();
cosullivan commented 8 months ago

I've fixed this now.

Thanks, Cain.