Skip to content
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

Ensure that dot stuffing is done after encoding #22

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function writeBase64($input): void
*/
protected function writeFiltered($input, string $filter, array $options = []): void
{
$filter = stream_filter_append($this->output, $filter, STREAM_FILTER_WRITE, $options);
$filter = stream_filter_prepend($this->output, $filter, STREAM_FILTER_WRITE, $options);

$this->write($input);

Expand Down
28 changes: 28 additions & 0 deletions tests/integration/MailServiceCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Kodus\Mail\Test\Integration;

use IntegrationTester;
use Kodus\Mail\Address;
use Kodus\Mail\Message;
use Kodus\Mail\SMTP\Authenticator\NoAuthenticator;
use Kodus\Mail\SMTP\SMTPMailService;
use Kodus\Mail\Test\TestMessageFactory;
Expand Down Expand Up @@ -31,4 +33,30 @@ public function sendMail(IntegrationTester $I)
$service->send($message);
}
}

public function ensureDotStuffingHappensBeforeQuotePrintableEncode(IntegrationTester $I)
{
$text_body = <<<EOT
Test mail 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890.
More text.
EOT;

$service = new SMTPMailService(
$I->createSocketConnector(), new NoAuthenticator(), "localhost"
);

$message = new Message(
new Address("[email protected]", "Rasmus åh Schultz"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I was about so say something about being personal, but I see this is copy/pasted from mindplay's own test examples back in the day, so this is a self-mention, so all good. 😄

new Address("[email protected]"),
"Hey, Rasmus! I like ÆØÅæøå!",
$text_body,
);

$message->setDate("Thu, 15 Sep 2016 17:20:54 +0200");

$message->setSender(new Address("[email protected]"));

// Throws \Kodus\Mail\SMTP\UnexpectedCodeException if dot stuffing is after encoding
$service->send($message);
}
}