Skip to content

Commit e13f7c7

Browse files
Do not throw transport exception when in interactive mode
1 parent ee18da7 commit e13f7c7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/Mailer/Transport/SendmailTransport.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function __construct(?string $command = null, ?EventDispatcherInterface $
6464
$this->stream = new ProcessStream();
6565
if (str_contains($this->command, ' -bs')) {
6666
$this->stream->setCommand($this->command);
67+
$this->stream->setInteractive(true);
6768
$this->transport = new SmtpTransport($this->stream, $dispatcher, $logger);
6869
}
6970
}

src/Symfony/Component/Mailer/Transport/Smtp/Stream/ProcessStream.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ final class ProcessStream extends AbstractStream
2525
{
2626
private $command;
2727

28+
private $interactive = false;
29+
2830
public function setCommand(string $command)
2931
{
3032
$this->command = $command;
3133
}
3234

35+
public function setInteractive(bool $interactive)
36+
{
37+
$this->interactive = $interactive;
38+
}
39+
3340
public function initialize(): void
3441
{
3542
$descriptorSpec = [
@@ -63,7 +70,7 @@ public function terminate(): void
6370

6471
parent::terminate();
6572

66-
if (isset($errorMessage)) {
73+
if (!$this->interactive && isset($errorMessage)) {
6774
throw new TransportException($errorMessage);
6875
}
6976
}

0 commit comments

Comments
 (0)