@@ -316,6 +316,52 @@ public function testSendFullEmailWithSuccess()
316316 $ this ->assertEquals ([new Address ('bcc@example.com ' )], $ sentMessage ->getOriginalMessage ()->getBcc ());
317317 }
318318
319+ public function testSendEmailWithAttachmentsWithSuccess ()
320+ {
321+ $ email = $ this ->basicValidEmail ()
322+ ->text ('foobar ' )
323+ ->attach ('some attachment ' , 'attachment.txt ' , 'text/plain ' )
324+ ->embed ('some inline attachment ' , 'inline.txt ' , 'text/plain ' )
325+ ;
326+
327+ $ sentMessage = $ this ->transport ->send ($ email );
328+
329+ $ this ->assertInstanceOf (SentMessage::class, $ sentMessage );
330+ $ this ->assertStringMatchesFormat (
331+ <<<'TXT'
332+ %a
333+ Content-Type: multipart/mixed; boundary=%s
334+
335+ --%s
336+ Content-Type: multipart/related; boundary=%s
337+
338+ --%s
339+ Content-Type: text/plain; charset=utf-8
340+ Content-Transfer-Encoding: quoted-printable
341+
342+ foobar
343+ --%s
344+ Content-ID: %s
345+ Content-Type: text/plain; name=inline.txt
346+ Content-Transfer-Encoding: base64
347+ Content-Disposition: inline; name=inline.txt; filename=inline.txt
348+
349+ c29tZSBpbmxpbmUgYXR0YWNobWVudA==
350+ --%s--
351+
352+ --%s
353+ Content-Type: text/plain; name=attachment.txt
354+ Content-Transfer-Encoding: base64
355+ Content-Disposition: attachment; name=attachment.txt;
356+ filename=attachment.txt
357+
358+ c29tZSBhdHRhY2htZW50
359+ --%s--
360+ TXT,
361+ $ sentMessage ->toString ()
362+ );
363+ }
364+
319365 public function testSentMessageShouldCaptureInfobipMessageId ()
320366 {
321367 $ this ->response = new MockResponse ('{"messages": [{"messageId": "somexternalMessageId0"}]} ' );
0 commit comments