-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(smtp): support RSET; better mailing workflow
- Loading branch information
Showing
2 changed files
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ class SmtpTest extends TestCase | |
|
||
public function testDispatchOneMail(): void | ||
{ | ||
$stream = StreamClientMock::createFromGenerator($this->mailMe()); | ||
$stream = StreamClientMock::createFromGenerator($this->mailMe(quit: true)); | ||
|
||
$this->runInFiber(static function () use ($stream) { | ||
foreach ((new Smtp())->dispatch($stream) as $frame) { | ||
|
@@ -58,7 +58,7 @@ public function testDispatchMultipleMails(): void | |
}); | ||
} | ||
|
||
private function mailMe(string $subject = 'Test email'): \Generator | ||
private function mailMe(string $subject = 'Test email', bool $quit = false): \Generator | ||
{ | ||
yield "EHLO\r\n"; | ||
yield "MAIL FROM: <[email protected]>\r\n"; | ||
|
@@ -72,6 +72,8 @@ private function mailMe(string $subject = 'Test email'): \Generator | |
yield "\r\n"; | ||
yield "Hello, this is a test email.\r\n"; | ||
yield ".\r\n"; | ||
yield "QUIT\r\n"; | ||
if ($quit) { | ||
yield "QUIT\r\n"; | ||
} | ||
} | ||
} |