Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Mailgun Mailer] fixed issue when using html body #32131

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

Merged
merged 1 commit into from
Jun 26, 2019
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
[Mailgun Mailer] fixed issue when using html body
  • Loading branch information
alOneh committed Jun 24, 2019
commit afbefe131b45001b4706c5205e52d6062ad79d09
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array
{
$headers = $email->getHeaders();
$html = $email->getHtmlBody();
if (null !== $html) {
if (null !== $html && \is_resource($html)) {
fabpot marked this conversation as resolved.
Show resolved Hide resolved
if (stream_get_meta_data($html)['seekable'] ?? false) {
rewind($html);
}
Expand Down
13 changes: 13 additions & 0 deletions 13 src/Symfony/Component/Mailer/Tests/TransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ public function testFromDsnMailgun()
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
$transport->send($message);

$message = (new Email())->from('me@me.com')->to('you@you.com')->subject('hello')->html('test');
fabpot marked this conversation as resolved.
Show resolved Hide resolved
$client = $this->createMock(HttpClientInterface::class);
$client->expects($this->once())->method('request')->with('POST', 'https://api.mailgun.net/v3/pa%24s/messages')->willReturn($response);
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
$transport->send($message);

$stream = fopen('data://text/plain,'.$message->getTextBody(), 'r');
$message = (new Email())->from('me@me.com')->to('you@you.com')->subject('hello')->html($stream);
$client = $this->createMock(HttpClientInterface::class);
$client->expects($this->once())->method('request')->with('POST', 'https://api.mailgun.net/v3/pa%24s/messages')->willReturn($response);
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
$transport->send($message);

$this->expectException(LogicException::class);
Transport::fromDsn('foo://mailgun');
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.