-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Mailer] Support getting sendmail path from php.ini #51749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,10 +38,27 @@ protected function tearDown(): void | |
|
|
||
| public function testToString() | ||
| { | ||
| $previousSendmailPath = \ini_set('sendmail_path', ''); | ||
| $t = new SendmailTransport(); | ||
| $this->assertEquals('smtp://sendmail', (string) $t); | ||
| } | ||
|
|
||
| public function testToStringNonSmtp() | ||
| { | ||
| $previousSendmailPath = \ini_set('sendmail_path', ''); | ||
| $t = new SendmailTransport('/usr/sbin/sendmail -t -i'); | ||
| \ini_set('sendmail_path', $previousSendmailPath); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should happen in |
||
| $this->assertEquals('sendmail://default', (string) $t); | ||
| } | ||
|
|
||
| public function testToStringPhpConfig() | ||
| { | ||
| $previousSendmailPath = \ini_set('sendmail_path', '/usr/sbin/sendmail -t -i'); | ||
| $t = new SendmailTransport(); | ||
| \ini_set('sendmail_path', $previousSendmailPath); | ||
| $this->assertEquals('sendmail://default', (string) $t); | ||
| } | ||
|
|
||
| public function testToIsUsedWhenRecipientsAreNotSet() | ||
| { | ||
| if ('\\' === \DIRECTORY_SEPARATOR) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,8 @@ | |
| */ | ||
| class SendmailTransport extends AbstractTransport | ||
| { | ||
| private string $command = '/usr/sbin/sendmail -bs'; | ||
| private const SENDMAIL_FHS_PATH = '/usr/sbin/sendmail -bs'; | ||
| private string $command; | ||
| private ProcessStream $stream; | ||
| private ?SmtpTransport $transport = null; | ||
|
|
||
|
|
@@ -59,6 +60,8 @@ public function __construct(string $command = null, EventDispatcherInterface $di | |
| } | ||
|
|
||
| $this->command = $command; | ||
| } else { | ||
| $this->command = \ini_get('sendmail_path') ?: self::SENDMAIL_FHS_PATH; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will change the default behavior: before: |
||
| } | ||
|
|
||
| $this->stream = new ProcessStream(); | ||
|
|
@@ -83,7 +86,7 @@ public function __toString(): string | |
| return (string) $this->transport; | ||
| } | ||
|
|
||
| return 'smtp://sendmail'; | ||
| return 'sendmail://default'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that a bugfix? I think this should go on 5.4 |
||
| } | ||
|
|
||
| protected function doSend(SentMessage $message): void | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should happen in
setUp().There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or we should use
$this->iniSet()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 sebastianbergmann/phpunit#5214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not relevant to all tests, though.