Jump to content

[BUG 4.6.7] Duplicate emailWrapper in outgoing emails


Go to solution Solved by Stuart Silvester,

Recommended Posts

Posted (edited)

We have an hook that injects some HTML at the bottom of the emails to add some buttons. After upgrading from 4.4.10 to 4.6.7 we noticed that these buttons are showing twice.

After some investigation I found this is an IPS bug. Here's the steps to replicate it on a fresh install:

  1. Make a fresh install of 4.6.7
  2. Add a new user from ACP
  3. Now send a PM to this new user
  4. The notification email sent out will have a duplicate wrapper. By inspecting the email source you can immediately see duplicate HTML/HEAD/BODY elements, and the first parsed wrapper also has an empty TITLE element.
  5. From a quick look at the issue it seems to first parse the content using the wrapper (emailWrapper template; empty subject), but then the code parses it again without wrapper (emailNoWrapper template; subject available) which ends up including the original emailWrapper template inside the emailNoWrapper one.

Testing the same steps above on 4.4.10 works just fine with no duplicate email wrapper.

 

Here's an example from the fresh install I just tested with:

MIME-Version: 1.0
To: test@example.com
From: =?UTF-8?B?RnJlc2g0NiBURVNU?= <admin@example.com>
Subject: =?UTF-8?B?YWRtaW4gaGFzIHNlbnQgeW91IGEgbWVzc2FnZQ==?=
Date: Sat, 23 Oct 2021 17:19:04 +0000
Auto-Submitted: auto-generated
Precedence: list
Content-Type: multipart/alternative; boundary="--==_mimepart_da312dd3c6432b943a6145ba67acbc52"; charset=UTF-8
Content-Transfer-Encoding: 8bit


----==_mimepart_da312dd3c6432b943a6145ba67acbc52
Content-Type: text/plain; charset=UTF-8





Hi test,


admin has sent you a message!

URL to this message:https://domain.com/fresh46/index.php?app=core&module=system&controller=redirect&url=https://domain.com/fresh46/messenger/2/?do=findComment%26amp;comment=3&key=4df9a37bc60e06121941d8a98d6950d1fdd34a64a99233184b44e8dbc0c25d62&email=1&type=notification_new_private_message

-- Fresh46 TEST

-----

Prefer to stop receiving these emails? Adjust your notification preferences:https://domain.com/fresh46/index.php?app=core&module=system&controller=redirect&url=https://domain.com/fresh46/notifications/options/?type=new_private_message&key=0d1fdf7b1daa337cf4545cdb86d8ac57ef8d19c9675bbe1e84fb701c66c12b1b&email=1&type=notification_new_private_message



Fresh46 TEST
----==_mimepart_da312dd3c6432b943a6145ba67acbc52
Content-Type: text/html; charset=UTF-8


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<title>admin has sent you a message</title>
	</head>
	<body>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title></title><style type="text/css">
		
			#outlook a {padding:0;}
			body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} 
			.ExternalClass {width:100%;}
			.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
			#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}

			img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} 
			a img {border:none;} 
			.image_fix {display:block;}

			p {margin: 1em 0;}

			h1 { color: white !important; }
			h2, h3, h4, h5, h6 {color: #333333 !important;}

			h1 a:active, h2 a:active,  h3 a:active, h4 a:active, h5 a:active, h6 a:active {
				color: red !important;
			}

			h1 a:visited, h2 a:visited,  h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
				color: purple !important;
			}

			table td {border-collapse: collapse;}

			table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }

			a {color: #4a8aca;}
			
			/* Unhides cells that we set to hide in the HTML in case the client doesn't support style properly */
			*[class~=hidePhone] {
			    display : block !important;
			    width : auto !important;
			    max-height: inherit !important;
			    overflow : visible !important;
			    float : none !important;
			}

			*[class~=hidePhone][width="30"] {
				width: 30px !important;
			}

			*[class~=hidePhone][width="40"] {
				width: 40px !important;
			}

			td[class~=hidePhone] {
				display: table-cell !important;
			}

			.ipsImage {
				max-width: 100% !important;
				height: auto !important;
			}

			/* Attachment styles for rich text */
			.ipsAttachLink_image,
			.ipsAttachLink {
				margin-bottom: 15px;
			}
			
			html[dir="ltr"] .ipsAttachLink_image.ipsAttachLink_right,
			html[dir="ltr"] .ipsAttachLink.ipsAttachLink_right,
			html[dir="rtl"] .ipsAttachLink_image.ipsAttachLink_left,
			html[dir="rtl"] .ipsAttachLink.ipsAttachLink_left {
				margin-left: 30px;
			}
			html[dir="ltr"] .ipsAttachLink_image.ipsAttachLink_left, 
			html[dir="ltr"] .ipsAttachLink.ipsAttachLink_left, 
			html[dir="rtl"] .ipsAttachLink_image.ipsAttachLink_right, 
			html[dir="rtl"] .ipsAttachLink.ipsAttachLink_right {
				margin-right: 30px;
			}

			@media only screen and (max-width: 480px) {
				a[href^="tel"], a[href^="sms"] {
					text-decoration: none;
					color: blue;
					pointer-events: none;
					cursor: default;
				}

				.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
					text-decoration: default;
					color: orange !important;
					pointer-events: auto;
					cursor: default;
				}

				#userPhoto, .hidePhone, *[class~=hidePhone], td[class~=hidePhone] {
					display: none !important;
				}

				.responsive_table > tr > td, .responsive_table > tbody > tr > td,
				.responsive_table > tr, .responsive_table > tbody > tr {
					display: block;
					text-align: left;
				}

				html[dir="rtl"] .responsive_table > tr > td, html[dir="rtl"] .responsive_table > tbody > tr > td,
				html[dir="rtl"] .responsive_table > tr, html[dir="rtl"] .responsive_table > tbody > tr {
					text-align: right;
				}

				.responsive_row {
					margin-bottom: 10px;
				}

				.responsive_fullwidth {
					width: 100% !important;
				}

				.cOurPicksRow {
					margin-bottom: 30px;
					padding-bottom: 30px;
					border-bottom: 1px solid #e0e0e0;
				}
			}

			@media only screen and (min-width: 768px) and (max-width: 1024px) {
				a[href^="tel"], a[href^="sms"] {
					text-decoration: none;
					color: blue;
					pointer-events: none;
					cursor: default;
				}

				.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
					text-decoration: default;
					color: orange !important;
					pointer-events: auto;
					cursor: default;
				}
			}

			/* Share Links */
			.cShareLink:hover {
				color: white;
			}
		</style></head><body bgcolor="#f1f1f1" style="direction: ltr">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#f1f1f1"><tr height="25"><td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
			</tr><tr><td dir="ltr" valign="top"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr" valign="middle" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 30px; font-weight: 300; color: #262e33; line-height: 48px; padding-left: 10px;">
					<a href="https://domain.com/fresh46/index.php?app=core&amp;module=system&amp;controller=redirect&amp;url=https://domain.com/fresh46/&amp;key=cb99a705e6f025cd80687c8d430fe22527258e47f2bd97dbfce85e74ba0dcf85&amp;email=1&amp;type=notification_new_private_message" style="text-decoration: none; color: #262e33; border: 0;">
						
						
						
							Fresh46 TEST
						
					</a>
				</td>
				<td dir="ltr" valign="top"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
			</tr><tr height="25"><td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
			</tr><tr><td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr" width="800" id="main" bgcolor="#ffffff" style="border-top: 10px solid #177ec9; line-height: 1.5;">
					<table width="100%" cellpadding="20" style="table-layout: fixed;"><tr><td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px; overflow-wrap: break-word;">
								
								
									<strong style="font-size: 17px">Hi test,</strong>
									<br>
								

								
admin has sent you a message!
<br><br><a href="https://domain.com/fresh46/index.php?app=core&amp;module=system&amp;controller=redirect&amp;url=https://domain.com/fresh46/messenger/2/?do=findComment%26comment=3&amp;key=f47d2ca3aea6fe468a71daf49819d556109baa5b159434ec2f37e6fd84afb55a&amp;email=1&amp;type=notification_new_private_message" style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 12px; background: #177ec9; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">Read full message</a>

<br><br><em style="color: #8c8c8c">— Fresh46 TEST</em>

<br><br><hr style="height: 0px; border-top: 1px solid #f0f0f0;"><table width="100%" cellpadding="10" cellspacing="0" border="0"><tr><td dir="ltr">
			<strong>2 members active in this conversation (including you)</strong>
		</td>
	</tr><tr><td dir="ltr">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="responsive_table"><tr><td dir="ltr" width="200" class="responsive_row">
							<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td dir="ltr" width="50">
										<img src="https://domain.com/fresh46/applications/core/interface/email/default_photo.png" width="40" height="40" style="border: 1px solid #777777; vertical-align: middle;"></td>
									<td dir="ltr">
										<strong>test</strong><br><span style="font-size: 14px">Members</span>
									</td>
								</tr></table></td>
						
						
					
				
					
						
						<td dir="ltr" width="200" class="responsive_row">
							<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td dir="ltr" width="50">
										<img src="https://domain.com/fresh46/applications/core/interface/email/default_photo.png" width="40" height="40" style="border: 1px solid #777777; vertical-align: middle;"></td>
									<td dir="ltr">
										<strong>admin</strong><br><span style="font-size: 14px">Administrators</span>
									</td>
								</tr></table></td>
						
						
					
				
				
					<td dir="ltr"> </td>
					
					
				
					<td dir="ltr"> </td>
					
						</tr></table></td>
	</tr></table><br><br><table width="100%" cellpadding="15" cellspacing="0" border="0" style="background: #f5f5f5"><tr><td dir="ltr">
			<h2 style="margin: 0; font-size: 19px; font-weight: 500">This is a test PM</h2>
		</td>
	</tr></table><br><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td dir="ltr" width="20" class="hidePhone" style="width: 0; max-height: 0; overflow: hidden; float: left;"> </td>
		<td dir="ltr" width="100" valign="top" align="center" class="hidePhone" style="width: 0; max-height: 0; overflow: hidden; float: left;">
			<img src="https://domain.com/fresh46/applications/core/interface/email/default_photo.png" width="75" height="75" style="border: 1px solid #777777; vertical-align: middle;"></td>
		<td dir="ltr" width="20" class="hidePhone" style="width: 0; max-height: 0; overflow: hidden; float: left;"> </td>
		<td dir="ltr" valign="top">
			<div style="line-height: 1.5">
				Test PM to test the duplicate emailWrapper bug.
 
...
			</div>
			<br><hr style="height: 0px; border-top: 1px solid #f0f0f0;"><br><a href="https://domain.com/fresh46/index.php?app=core&amp;module=system&amp;controller=redirect&amp;url=https://domain.com/fresh46/messenger/2/?do=findComment%26comment=3&amp;key=f47d2ca3aea6fe468a71daf49819d556109baa5b159434ec2f37e6fd84afb55a&amp;email=1&amp;type=notification_new_private_message" style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 12px; background: #177ec9; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">Read full message</a>
		</td>
		<td dir="ltr" width="20" class="hidePhone" style="width: 0; max-height: 0; overflow: hidden; float: left;"> </td>
	</tr></table></td>
						</tr></table></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
			</tr><tr height="25"><td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				<td dir="ltr"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
			</tr><tr><td dir="ltr" valign="top"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
		<td dir="ltr" valign="middle" align="center" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 12px; line-height: 18px; padding-left: 10px;">
			Prefer to stop receiving these emails? <a href="https://domain.com/fresh46/index.php?app=core&amp;module=system&amp;controller=redirect&amp;url=https://domain.com/fresh46/notifications/options/?type=new_private_message&amp;key=0d1fdf7b1daa337cf4545cdb86d8ac57ef8d19c9675bbe1e84fb701c66c12b1b&amp;email=1&amp;type=notification_new_private_message" style="color: #4a8aca; text-decoration: none; display: inline-block">Adjust your notification preferences</a>.
			<br></td>
	</tr><tr><td dir="ltr" valign="top"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
					<td dir="ltr" valign="top" width="800" align="center" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 12px; color: #bdbdbd; line-height: 18px; padding-left: 10px;">
						Fresh46 TEST
					</td>
					<td dir="ltr" valign="top"><img src="https://domain.com/fresh46/applications/core/interface/email/spacer.png" width="1" height="1" alt=""></td>
				</tr></table></body></html>

	</body>
</html>

----==_mimepart_da312dd3c6432b943a6145ba67acbc52--

 

Edited by teraßyte
  • 4 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...