genkgo / mail

Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
https://mail.readthedocs.io/
Other
402 stars 21 forks source link

ssl custom context stream options #19

Closed rodrigo-garcia-engrande closed 6 years ago

rodrigo-garcia-engrande commented 7 years ago

I do not see a way to add custom context stream options, for example verify_peer, verify_peer_name and allow_self_signed Is it possible?

frederikbosch commented 7 years ago

At this moment not. But I'd love to have this feature. Since I already foresaw that secure streams require configuration, I created the SecureConnectionOptions class. It allows to add your suggestions. Are you able to create a PR for this?

rodrigo-garcia-engrande commented 7 years ago

Not know, but as soon as i am able will do. Thanks.

frederikbosch commented 7 years ago

Ok, if I find time, I will fix this. Thanks for the suggestion.

frederikbosch commented 6 years ago

PR #49 fixes this issue. In order to create a secure connection with extra stream context options, you cannot use the client factory but you will have to setup a connection instance yourself.


$client = new Client(
    new SecureConnection(
        'host',
        465,
        new SecureConnectionOptions(
            STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
            10,
            ['verify_peer' => false]
        )
    )
);