@@ -39,7 +39,6 @@ class SmtpTransport extends AbstractTransport
3939 private int $ pingThreshold = 100 ;
4040 private float $ lastMessageTime = 0 ;
4141 private AbstractStream $ stream ;
42- private string $ mtaResult = '' ;
4342 private string $ domain = '[127.0.0.1] ' ;
4443
4544 public function __construct (?AbstractStream $ stream = null , ?EventDispatcherInterface $ dispatcher = null , ?LoggerInterface $ logger = null )
@@ -148,10 +147,6 @@ public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMess
148147 throw $ e ;
149148 }
150149
151- if ($ this ->mtaResult && $ messageId = $ this ->parseMessageId ($ this ->mtaResult )) {
152- $ message ->setMessageId ($ messageId );
153- }
154-
155150 $ this ->checkRestartThreshold ();
156151
157152 return $ message ;
@@ -235,9 +230,13 @@ protected function doSend(SentMessage $message): void
235230 $ this ->getLogger ()->debug (sprintf ('Email transport "%s" stopped ' , __CLASS__ ));
236231 throw $ e ;
237232 }
238- $ this -> mtaResult = $ this ->executeCommand ("\r\n. \r\n" , [250 ]);
233+ $ mtaResult = $ this ->executeCommand ("\r\n. \r\n" , [250 ]);
239234 $ message ->appendDebug ($ this ->stream ->getDebug ());
240235 $ this ->lastMessageTime = microtime (true );
236+
237+ if ($ mtaResult && $ messageId = $ this ->parseMessageId ($ mtaResult )) {
238+ $ message ->setMessageId ($ messageId );
239+ }
241240 } catch (TransportExceptionInterface $ e ) {
242241 $ e ->appendDebug ($ this ->stream ->getDebug ());
243242 $ this ->lastMessageTime = 0 ;
0 commit comments