@@ -114,8 +114,16 @@ private function doEhloCommand(): string
114
114
{
115
115
try {
116
116
$ response = $ this ->executeCommand (sprintf ("EHLO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
117
- } catch (TransportExceptionInterface ) {
118
- return parent ::executeCommand (sprintf ("HELO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
117
+ } catch (TransportExceptionInterface $ e ) {
118
+ try {
119
+ return parent ::executeCommand (sprintf ("HELO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
120
+ } catch (TransportExceptionInterface $ ex ) {
121
+ if (!$ ex ->getCode ()) {
122
+ throw $ e ;
123
+ }
124
+
125
+ throw $ ex ;
126
+ }
119
127
}
120
128
121
129
$ this ->capabilities = $ this ->parseCapabilities ($ response );
@@ -132,12 +140,8 @@ private function doEhloCommand(): string
132
140
throw new TransportException ('Unable to connect with STARTTLS. ' );
133
141
}
134
142
135
- try {
136
- $ response = $ this ->executeCommand (sprintf ("EHLO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
137
- $ this ->capabilities = $ this ->parseCapabilities ($ response );
138
- } catch (TransportExceptionInterface ) {
139
- return parent ::executeCommand (sprintf ("HELO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
140
- }
143
+ $ response = $ this ->executeCommand (sprintf ("EHLO %s \r\n" , $ this ->getLocalDomain ()), [250 ]);
144
+ $ this ->capabilities = $ this ->parseCapabilities ($ response );
141
145
}
142
146
143
147
if (\array_key_exists ('AUTH ' , $ this ->capabilities )) {
0 commit comments