Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
Revise rendered content
Browse files Browse the repository at this point in the history
  • Loading branch information
ro0NL authored and fabpot committed Jan 5, 2019
1 parent 3fc0cd7 commit 4192e92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions DataCollector/MessageDataCollector.php
Expand Up @@ -60,9 +60,17 @@ public function collect(Request $request, Response $response, \Exception $except
];

foreach ($logger->getMessages() as $message) {
($userContentTypeProp = new \ReflectionProperty(\Swift_Message::class, 'userContentType'))->setAccessible(true);
$message->__contentType = $userContentTypeProp->getValue($message);
$message->__contentType = $message->getBodyContentType();
$message->__base64EncodedBody = base64_encode($message->getBody());
if ('text/plain' === $message->__contentType) {
foreach ($message->getChildren() as $child) {
if ('text/html' === $child->getContentType()) {
$message->__contentType = 'text/html';
$message->__base64EncodedBody = base64_encode($child->getBody());
break;
}
}
}
$this->data['mailer'][$name]['messages'][] = $message;
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": ">=7.0.0",
"swiftmailer/swiftmailer": "^6.0.1",
"swiftmailer/swiftmailer": "^6.1.3",
"symfony/dependency-injection": "~2.7|~3.3|~4.0",
"symfony/http-kernel": "~2.7|~3.3|~4.0",
"symfony/config": "~2.8|~3.3|~4.0"
Expand Down

0 comments on commit 4192e92

Please sign in to comment.