File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ public function __construct(
68
68
'host ' => 'string ' ,
69
69
'port ' => 'int ' ,
70
70
'tls ' => 'bool ' ,
71
+ 'options ' => 'array ' ,
71
72
'username ' => 'string|null ' ,
72
73
'password ' => 'string|null ' ,
73
74
'charset ' => 'string ' ,
@@ -84,6 +85,13 @@ protected function makeConfig(#[SensitiveParameter] array $config) : array
84
85
'host ' => 'localhost ' ,
85
86
'port ' => 587 ,
86
87
'tls ' => true ,
88
+ 'options ' => [
89
+ 'ssl ' => [
90
+ 'allow_self_signed ' => false ,
91
+ 'verify_peer ' => true ,
92
+ 'verify_peer_name ' => true ,
93
+ ],
94
+ ],
87
95
'username ' => null ,
88
96
'password ' => null ,
89
97
'charset ' => 'utf-8 ' ,
@@ -115,6 +123,7 @@ protected function getConfig(string $key) : mixed
115
123
'host ' => 'string ' ,
116
124
'port ' => 'int ' ,
117
125
'tls ' => 'bool ' ,
126
+ 'options ' => 'array ' ,
118
127
'username ' => 'string|null ' ,
119
128
'password ' => 'string|null ' ,
120
129
'charset ' => 'string ' ,
Original file line number Diff line number Diff line change @@ -37,12 +37,13 @@ protected function connect() : bool
37
37
return $ this ->sendCommand ('EHLO ' . $ this ->getConfig ('hostname ' )) === 250 ;
38
38
}
39
39
$ this ->disconnect ();
40
- $ this ->socket = @\fsockopen (
41
- $ this ->getConfig ('host ' ),
42
- (int ) $ this ->getConfig ('port ' ),
40
+ $ this ->socket = @\stream_socket_client (
41
+ $ this ->getConfig ('host ' ) . ': ' . $ this ->getConfig ('port ' ),
43
42
$ errorCode ,
44
43
$ errorMessage ,
45
- (float ) $ this ->getConfig ('connection_timeout ' )
44
+ (float ) $ this ->getConfig ('connection_timeout ' ),
45
+ \STREAM_CLIENT_CONNECT ,
46
+ \stream_context_create ($ this ->getConfig ('options ' ))
46
47
);
47
48
if ($ this ->socket === false ) {
48
49
$ this ->addLog ('' , 'Socket connection error ' . $ errorCode . ': ' . $ errorMessage );
You can’t perform that action at this time.
0 commit comments