Hi all, I think this is a bug in the email system that sends the html emails out.
Email - Error: No “p” element in scope but a “p” end tag seen.
\app\Plugin\Mail\View\Emails\html
default.ctp
<?php
$content = explode("\n", $content);
foreach ($content as $line):
echo '<p> ' . $line . "</p>\n";
endforeach;
?>
$content = explode("\n", $content);
foreach ($content as $line):
echo '<p> ' . $line . "</p>\n";
endforeach;
?>
<p> </p><p></p><p>Hello Members Name,</p><p></p><p></p> <p> </p><p>The admin has changed your password to ##############</p><p></p> <p> </p><p></p><p>Best Regards,<br>Social Network Administration</p><p></p><p></p> <p> </p>
I think you should change this to a just newline:-
<?php
$content = explode("\n", $content);
$content = explode("\n", $content);
foreach ($content as $line):
echo $line . "\n";
endforeach;
?>
This is a resend of "Resend Validation Email" look so much better with just the \n (newline) tag and not both <p> tags. Still some issues but I will find them.
Source from email:-
<table width="620" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="background:#E7E7DE;color:#000000;font-weight:bold;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;vertical-align:middle;padding:4px 8px;font-size:16px;letter-spacing:-0.03em;text-align:left;border:1px solid #CCCCCC">
Site name </td>
</tr>
<tr>
<td style="background-color:#FFFFFF;border-bottom:1px solid #333333;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;padding:15px">
<p><p>Hello User Name,</p></p>
<p>Thank you for joining our social network. Click the following link and enter your information below to login:</p>
<p><a href="https://MyDomain.com/users/member_login">https://MyDomain.com/users/member_login</a></p>
<p>Email: User.Name@MyDomain.com</p>
<p><p>Best Regards,<br />Social Network Administration</p></p>
</td>
</tr>
</table>
<div style="color:#999999;padding:10px;font-size:12px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif">
This is an automated generated email. Please do not respond to it.<br />
If you don't want to receive these emails in the future, please visit <a href="https://MyDomain.com">My Site</a> and change your email setting.</div>
The problem is also coming from TinyMCE. This is an example:-
Let say I want to change the mail template for Header (Members). I select it from the Choose Email drop menu. Check source <> and find it has <P> around the the Hello [recipient_title],
So I delete the <P>'s and save. Then I check source again and they are back. This is also a TinyMCE bug.
Now I have to write a TinyMCE script to stop this from happening... More work.
Problem solved by editing this file:-
\app\Plugin\Mail\View\MailPlugins
admin_index.ctp
Copy & Paste the code below in between lines 112-113
force_br_newlines : false,
force_p_newlines : false,
forced_root_block : '',
This will stop TinyMCE adding the <p> around text when you are saving.
Save and test.
Result from email source with template
Header part of the email:-
<div class="lead">
<p>Hello User Name,</p>
<p>Thank you for joining our social network. Click the following link and enter your information below to login:</p>
<p><a href="https://MyDomain.com/users/member_login">https://MyDomain.com/users/member_login</a></p>
<p>Email: user.name@MyDomain.com</p>
<p>Best Regards,<br />Social Network Administration</p>
</div>
Footer part of the email:-
<table class="row callout">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td class="panel">
This is an automated generated email. Please do not respond to it.<br />
If you don't want to receive these emails in the future, please visit <a href="https://MyDomain.com/users/profile">MySiteName</a> and change your email setting.
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
-------------------------------------------------------------------------------------------------
Email header & content:-
<td>
<div class="lead">
<p>Hello User Name,</p>
<p>The admin has changed your password to ########</p>
<p>Best Regards,<br />Social Network Administration</p>
</div>
</td>
Email footer:-
<td class="panel">
This is an automated generated email. Please do not respond to it.<br />
If you don't want to receive these emails in the future, please visit <a href="https://MyDomain.com/users/profile">Site Name</a> and change your email setting.
</td>
<td class="expander"></td>
This is using the Header (Memebers) email template and Footer (Memebers) email template. From the "Resend Validation Email" and "admin has change your password email"
So much better!
For anybody who wants to check this; use Thunderbird CTRL-u to check source code in the email.
If we want to follow good html practices we should update this lol
This is also a TinyMCE bug.
Ryan Nguyen when you get the time get your team to have a look over this topic.