File tree 1 file changed +12
-1
lines changed
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
19
19
{
20
20
public string $ commandArgs = '' ;
21
21
private ?Signer $ signer = null ;
22
+ private bool $ envelopeSender = true ;
22
23
23
24
24
25
public function setSigner (Signer $ signer ): static
@@ -28,6 +29,16 @@ public function setSigner(Signer $signer): static
28
29
}
29
30
30
31
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
+
31
42
/**
32
43
* Sends email.
33
44
* @throws SendException
@@ -48,7 +59,7 @@ public function send(Message $mail): void
48
59
$ parts = explode (Message::EOL . Message::EOL , $ data , 2 );
49
60
50
61
$ cmd = $ this ->commandArgs ;
51
- if ($ from = $ mail ->getFrom ()) {
62
+ if ($ this -> envelopeSender && ( $ from = $ mail ->getFrom () )) {
52
63
$ cmd .= ' -f ' . key ($ from );
53
64
}
54
65
You can’t perform that action at this time.
0 commit comments