8000 [Mailer] Use recipients in sendmail transport · symfony/symfony@8958239 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8958239

Browse files
committed
[Mailer] Use recipients in sendmail transport
1 parent ab136f0 commit 8958239

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ protected function doSend(SentMessage $message): void
8686
$this->getLogger()->debug(sprintf('Email transport "%s" starting', __CLASS__));
8787

8888
$command = $this->command;
89+
90+
if (!empty($recipients = $message->getEnvelope()->getRecipients())) {
91+
$command = str_replace(' -t', '', $command);
92+
}
93+
8994
if (!str_contains($command, ' -f')) {
9095
$command .= ' -f'.escapeshellarg($message->getEnvelope()->getSender()->getEncodedAddress());
9196
}
@@ -96,6 +101,10 @@ protected function doSend(SentMessage $message): void
96101
$chunks = AbstractStream::replace("\n.", "\n..", $chunks);
97102
}
98103

104+
foreach ($recipients as $recipient) {
105+
$command .= ' '.escapeshellarg($recipient->getEncodedAddress());
106+
}
107+
99108
$this->stream->setCommand($command);
100109
$this->stream->initialize();
101110
foreach ($chunks as $chunk) {

0 commit comments

Comments
 (0)
0