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 46cda1e

Browse filesBrowse files
committed
feature #43751 [WebProfilerBundle] Add a "preview" tab in mailer profiler for HTML email (lyrixx)
This PR was merged into the 5.4 branch. Discussion ---------- [WebProfilerBundle] Add a "preview" tab in mailer profiler for HTML email | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | no need I did not work with mail for a long time, and I just discover the new entry in the profile. This is very nice 👏🏼 But I miss a preview rendering, so here we go ![image](https://user-images.githubusercontent.com/408368/138895761-7a6f49a4-d670-44e6-b59b-093eb59b924b.png) Commits ------- aae2768 [WebProfilerBundle] Add a "previews tab in mailer profiler for HTML email
2 parents 08abf4e + aae2768 commit 46cda1e
Copy full SHA for 46cda1e

File tree

3 files changed

+26
-1
lines changed
Filter options

3 files changed

+26
-1
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.4
5+
---
6+
7+
* Add a "preview" tab in mailer profiler for HTML email
8+
49
5.2.0
510
-----
611

@@ -33,7 +38,7 @@ CHANGELOG
3338
-----
3439

3540
* added information about orphaned events
36-
* made the toolbar auto-update with info from ajax reponses when they set the
41+
* made the toolbar auto-update with info from ajax reponses when they set the
3742
`Symfony-Debug-Toolbar-Replace header` to `1`
3843

3944
4.0.0

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/mailer.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/mailer.html.twig
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@
141141
</div>
142142
{% if message.htmlBody is defined %}
143143
{# Email instance #}
144+
<div class="tab">
145+
<h3 class="tab-title">HTML preview</h3>
146+
<div class="tab-content">
147+
<pre class="prewrap" style="max-height: 600px">
148+
<iframe
149+
src="data:text/html;base64;charset=utf-8,{{ collector.base64Encode(message.htmlBody()) }}"
150+
style="height: 80vh;width: 100%;"
151+
>
152+
</iframe>
153+
</pre>
154+
</div>
155+
</div>
144156
<div class="tab">
145157
<h3 class="tab-title">HTML Content</h3>
146158
<div class="tab-content">

‎src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ public function getEvents(): MessageEvents
4242
return $this->data['events'];
4343
}
4444

45+
/**
46+
* @internal
47+
*/
48+
public function base64Encode(string $data): string
49+
{
50+
return base64_encode($data);
51+
}
52+
4553
/**
4654
* {@inheritdoc}
4755
*/

0 commit comments

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