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

Fixed mutating content type from RelatedPart to MultiPart #195

Merged
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/MailTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected function createTrackers($message)
$newParts[] = $part;
}
}
$message->setBody(new AlternativePart(...$newParts));
$message->setBody(new (get_class($original_content))(...$newParts));
} else {
$original_html = $original_content->getBody();
if($original_content->getMediaSubtype() == 'html') {
Expand Down
6 changes: 3 additions & 3 deletions tests/MailTrackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function testSendMessageWithRelatedPart()
->andReturn('random-hash');

try {
Mail::send('email.embed-test', [], function ($message) use ($email, $name) {
Mail::send('email.embed-test', ['imagePath' => __DIR__ . '/email/example.png'], function ($message) use ($email, $name) {
$message->from('from@johndoe.com', 'From Name');
$message->sender('sender@johndoe.com', 'Sender Name');

Expand All @@ -256,8 +256,8 @@ public function testSendMessageWithRelatedPart()

$message->priority(3);
});
} catch (Exception $e) {
// dd($e);
} catch (TransportException $e) {

}

$this->assertDatabaseHas('sent_emails', [
Expand Down
2 changes: 1 addition & 1 deletion tests/email/embed-test.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
This is a test!
</h1>
<p>
<img src="{{ $message->embed(base_path()) }}" />
<img src="{{ $message->embed($imagePath) }}" />
</p>
</body>
Binary file added tests/email/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.