Skip to content

Commit b29d0be

Browse files
Merge branch '6.4' into 7.0
* 6.4: (21 commits) [ErrorHandler] Add missing self-closing tags on link elements Fix merge (bis) Fix merge Add missing return type [FrameworkBundle] ConfigBuilderCacheWarmer should be non-optional [HttpClient] Fix pausing responses before they start when using curl [Notifier] Updated the NTFY notifier to run without a user parameter [Translation] Fix constant domain resolution in PhpAstExtractor separate child and parent context in NotificationEmail on writes [Mailer] [Mailgun] Fix sender header encoding do not overwrite the cache key when it is false [Mailer] [Scaleway] Fix attachment handling [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts Revert #47715 [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [DependencyInjection] Fix loading all env vars from secrets when only a subset is needed Fix option filenameMaxLength to the File constraint (Image) [Serializer] Take unnamed variadic parameters into account when denormalizing ...
2 parents da6bb8b + c0b6a2e commit b29d0be

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Tests/Transport/ScalewayApiTransportTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Mailer\Exception\HttpTransportException;
1919
use Symfony\Component\Mime\Address;
2020
use Symfony\Component\Mime\Email;
21+
use Symfony\Component\Mime\Part\DataPart;
2122
use Symfony\Contracts\HttpClient\ResponseInterface;
2223

2324
class ScalewayApiTransportTest extends TestCase
@@ -64,6 +65,10 @@ public function testSend()
6465
$this->assertSame(['email' => 'saif.gmati@symfony.com', 'name' => 'Saif Eddin'], $body['to'][0]);
6566
$this->assertSame('Hello!', $body['subject']);
6667
$this->assertSame('Hello There!', $body['text']);
68+
$this->assertCount(1, $body['attachments']);
69+
$this->assertSame('attachment.txt', $body['attachments'][0]['name']);
70+
$this->assertSame('text/plain', $body['attachments'][0]['type']);
71+
$this->assertSame(base64_encode('some attachment'), $body['attachments'][0]['content']);
6772

6873
return new JsonMockResponse(['emails' => [['message_id' => 'foobar']]], [
6974
'http_code' => 200,
@@ -76,7 +81,8 @@ public function testSend()
7681
$mail->subject('Hello!')
7782
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
7883
->from(new Address('fabpot@symfony.com', 'Fabien'))
79-
->text('Hello There!');
84+
->text('Hello There!')
85+
->addPart(new DataPart('some attachment', 'attachment.txt', 'text/plain'));
8086

8187
$message = $transport->send($mail);
8288

Transport/ScalewayApiTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function getPayload(Email $email, Envelope $envelope): array
9999
$payload['html'] = $email->getHtmlBody();
100100
}
101101
if ($attachements = $this->prepareAttachments($email)) {
102-
$payload['attachment'] = $attachements;
102+
$payload['attachments'] = $attachements;
103103
}
104104

105105
return $payload;
@@ -115,7 +115,7 @@ private function prepareAttachments(Email $email): array
115115
$attachments[] = [
116116
'name' => $filename,
117117
'type' => $headers->get('Content-Type')->getBody(),
118-
'content' => base64_encode($attachment->bodyToString()),
118+
'content' => str_replace("\r\n", '', $attachment->bodyToString()),
119119
];
120120
}
121121

0 commit comments

Comments
 (0)