This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,9 @@ protected function prepareParameters(Mail\Message $message)
259259 }
260260
261261 $ parameters = (string ) $ this ->parameters ;
262+ if (preg_match ('/^\-f.+$/ ' , $ parameters ) || strpos ($ parameters , ' -f ' ) !== false ) {
263+ return $ parameters ;
264+ }
262265
263266 $ sender = $ message ->getSender ();
264267 if ($ sender instanceof AddressInterface) {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class SendmailTest extends TestCase
2727 public $ message ;
2828 public $ additional_headers ;
2929 public $ additional_parameters ;
30+ public $ operating_system ;
3031
3132 public function setUp ()
3233 {
@@ -252,4 +253,30 @@ public function testDoNotAllowMessageWithoutToAndCcAndBccHeaders()
252253 $ this ->expectException (RuntimeException::class);
253254 $ this ->transport ->send ($ message );
254255 }
256+
257+ public function testNotSetOptionAutomaticallyOnLeadingF ()
258+ {
259+ if ($ this ->operating_system == 'WIN ' ) {
260+ $ this ->markTestSkipped ('This test is *nix-specific ' );
261+ }
262+
263+ $ message = $ this ->getMessage ();
264+ $ this ->transport ->setParameters ('-f \'foo@example.com \'' );
265+
266+ $ this ->transport ->send ($ message );
267+ $ this ->assertEquals ('-f \'foo@example.com \'' , $ this ->additional_parameters );
268+ }
269+
270+ public function testNotSetOptionAutomaticallyOnMiddleF ()
271+ {
272+ if ($ this ->operating_system == 'WIN ' ) {
273+ $ this ->markTestSkipped ('This test is *nix-specific ' );
274+ }
275+
276+ $ message = $ this ->getMessage ();
277+ $ this ->transport ->setParameters ('-bs -f \'foo@example.com \'' );
278+
279+ $ this ->transport ->send ($ message );
280+ $ this ->assertEquals ('-bs -f \'foo@example.com \'' , $ this ->additional_parameters );
281+ }
255282}
You can’t perform that action at this time.
0 commit comments