From a98f57ebd0f6ebd2b715d95e85c33482ba629d7d Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Wed, 19 Jul 2017 11:19:19 +0200
Subject: [PATCH] Set max-width of image to 100px in Outlook as well

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
---
 lib/private/Mail/EMailTemplate.php                     | 3 +++
 tests/Settings/Mailer/NewUserMailHelperTest.php        | 6 ++++++
 tests/data/emails/new-account-email-custom.html        | 3 +++
 tests/data/emails/new-account-email-single-button.html | 3 +++
 tests/data/emails/new-account-email.html               | 3 +++
 5 files changed, 18 insertions(+)

diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index 0ae79345e4c..f924f233f14 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -100,7 +100,10 @@ EOF;
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="%s" alt="%s" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
diff --git a/tests/Settings/Mailer/NewUserMailHelperTest.php b/tests/Settings/Mailer/NewUserMailHelperTest.php
index a8b67278e77..cee3b15b946 100644
--- a/tests/Settings/Mailer/NewUserMailHelperTest.php
+++ b/tests/Settings/Mailer/NewUserMailHelperTest.php
@@ -182,7 +182,10 @@ class NewUserMailHelperTest extends TestCase {
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
@@ -415,7 +418,10 @@ EOF;
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
diff --git a/tests/data/emails/new-account-email-custom.html b/tests/data/emails/new-account-email-custom.html
index a60902ae306..4dd95db0510 100644
--- a/tests/data/emails/new-account-email-custom.html
+++ b/tests/data/emails/new-account-email-custom.html
@@ -23,7 +23,10 @@
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
diff --git a/tests/data/emails/new-account-email-single-button.html b/tests/data/emails/new-account-email-single-button.html
index 50763efa5b5..128f4f30db7 100644
--- a/tests/data/emails/new-account-email-single-button.html
+++ b/tests/data/emails/new-account-email-single-button.html
@@ -23,7 +23,10 @@
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
diff --git a/tests/data/emails/new-account-email.html b/tests/data/emails/new-account-email.html
index 32568e11b66..273e722e052 100644
--- a/tests/data/emails/new-account-email.html
+++ b/tests/data/emails/new-account-email.html
@@ -23,7 +23,10 @@
 							<tbody>
 							<tr style="padding:0;text-align:left;vertical-align:top">
 								<center data-parsed="" style="min-width:580px;width:100%">
+									<!-- convince Outlook to have a max-width of 100px -->
+									<!--[if mso]><table><tr><td width="100"><![endif]-->
 									<img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+									<!--[if mso]></td></tr></table><![endif]-->
 								</center>
 							</tr>
 							</tbody>
-- 
GitLab