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

Commit 5084d3a

Browse filesBrowse files
committed
[Mailgun Mailer] fixed issue when using html body
1 parent a25c2af commit 5084d3a
Copy full SHA for 5084d3a

File tree

Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed

‎src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array
6868
{
6969
$headers = $email->getHeaders();
7070
$html = $email->getHtmlBody();
71-
if (null !== $html) {
71+
var_dump($html);
72+
if (null !== $html && \is_resource($html)) {
7273
if (stream_get_meta_data($html)['seekable'] ?? false) {
7374
rewind($html);
7475
}

‎src/Symfony/Component/Mailer/Tests/TransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Tests/TransportTest.php
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ public function testFromDsnMailgun()
168168
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
169169
$transport->send($message);
170170

171+
$message = (new Email())->from('me@me.com')->to('you@you.com')->subject('hello')->html('test');
172+
$client = $this->createMock(HttpClientInterface::class);
173+
$client->expects($this->once())->method('request')->with('POST', 'https://api.mailgun.net/v3/pa%24s/messages')->willReturn($response);
174+
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
175+
$transport->send($message);
176+
177+
$stream = fopen('data://text/plain,'.$message->getTextBody(), 'r');
178+
$message = (new Email())->from('me@me.com')->to('you@you.com')->subject('hello')->html($stream);
179+
$client = $this->createMock(HttpClientInterface::class);
180+
$client->expects($this->once())->method('request')->with('POST', 'https://api.mailgun.net/v3/pa%24s/messages')->willReturn($response);
181+
$transport = Transport::fromDsn('api://'.urlencode('u$er').':'.urlencode('pa$s').'@mailgun?region=us', $dispatcher, $client, $logger);
182+
$transport->send($message);
183+
171184
$this->expectException(LogicException::class);
172185
Transport::fromDsn('foo://mailgun');
173186
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.