File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class SendmailMailer implements Mailer
1919{
2020 public string $ commandArgs = '' ;
2121 private ?Signer $ signer = null ;
22+ private bool $ envelopeSender = true ;
2223
2324
2425 public function setSigner (Signer $ signer ): static
@@ -28,6 +29,16 @@ public function setSigner(Signer $signer): static
2829 }
2930
3031
32+ /**
33+ * Sets whether to use the envelope sender (-f option) in the mail command.
34+ */
35+ public function setEnvelopeSender (bool $ state = true ): static
36+ {
37+ $ this ->envelopeSender = $ state ;
38+ return $ this ;
39+ }
40+
41+
3142 /**
3243 * Sends email.
3344 * @throws SendException
@@ -48,7 +59,7 @@ public function send(Message $mail): void
4859 $ parts = explode (Message::EOL . Message::EOL , $ data , 2 );
4960
5061 $ cmd = $ this ->commandArgs ;
51- if ($ from = $ mail ->getFrom ()) {
62+ if ($ this -> envelopeSender && ( $ from = $ mail ->getFrom () )) {
5263 $ cmd .= ' -f ' . key ($ from );
5364 }
5465
You can’t perform that action at this time.
0 commit comments