Skip to content

Commit 6a2ee30

Browse files
committed
SendmailMailer: fixed $commandArgs handling after 0e236e4 [Closes #93]
1 parent 90b6737 commit 6a2ee30

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Mail/SendmailMailer.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
class SendmailMailer implements Mailer
1919
{
20-
public ?string $commandArgs = null;
20+
public string $commandArgs = '';
2121
private ?Signer $signer = null;
2222

2323

@@ -47,21 +47,19 @@ public function send(Message $mail): void
4747
: $tmp->generateMessage();
4848
$parts = explode(Message::EOL . Message::EOL, $data, 2);
4949

50+
$cmd = $this->commandArgs;
51+
if ($from = $mail->getFrom()) {
52+
$cmd .= ' -f' . key($from);
53+
}
54+
5055
$args = [
5156
(string) $mail->getEncodedHeader('To'),
5257
(string) $mail->getEncodedHeader('Subject'),
5358
$parts[1],
5459
$parts[0],
60+
$cmd,
5561
];
5662

57-
if ($from = $mail->getFrom()) {
58-
$args[] = '-f' . key($from);
59-
}
60-
61-
if ($this->commandArgs) {
62-
$args[] = $this->commandArgs;
63-
}
64-
6563
$res = Nette\Utils\Callback::invokeSafe('mail', $args, function (string $message) use (&$info): void {
6664
$info = ": $message";
6765
});

0 commit comments

Comments
 (0)