OCS displaying HTML code in email body

Hi everyone! Our installation has problems with displaying undesired HTML tags in the emails that we send through OCS.

For example, when users go to conferences/test/Test-Conference-Scheduled/director/notifyUsers they get the following HTML code automatically inserted in the Body of the email:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Signature</p>
</body>
</html>

After hours of trial and error, I finally noticed that when I remove {$body|escape} from /conferences/conferences/templates/director/notifyUsers.tpl the html code isn’t inserted automatically in the text box anymore.

So, I think this first part of the issue can be called “solved” even if I’m not sure about the implications of removing {$body|escape} from the code…

But unfortunately, with every single email that is sent from /director/notifyUsers, the same HTML code is added automatically also to the text for the signature of the conference itself (as specified on Step 1. Details → 1.5 Email Identification).

Therefore, another set of HTML tags is added every time an email is sent to the users. For instance:

Text of the email.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This is the Signature of the <strong>conference</strong>.</p>
</body>
</html>

Similarly to the temporary workaround that I found for the first part of the issue, this time I tried with removing {$emailSignature[$formLocale]|escape} from the following line in conferences/templates/manager/schedConfSetup/step1.tpl:

<textarea name="emailSignature[{$formLocale|escape}]" id="emailSignature" rows="3" cols="60" class="textArea">{$emailSignature[$formLocale]|escape}</textarea>

However, without any success. The HTML code is still being displayed/included in every email we send.

Initially, I thought that this could be related to TinyMCE’s settings, but after turning off the plugin, it looks like something else is causing this as the problem is still present.

I would appreciate your advice and thoughts.

Thank you.

DD

Hi @Ddd,

OCS doesn’t currently support sending HTML-formatted emails – in addition to adding TinyMCE support to the compose box, you’ll also need to modify the email code to inform its receiver that the format is text/HTML, not plaintext.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi Alec,

Your suggestion worked like a charm – I replaced text/plain with text/HTML in Mail.inc.php and now all emails are showing without any HTML tags. Thank you!

What continues to bother me is the fact that some HTML tags are still being filled automatically in some email body boxes like the one for director/notifyUsers in

<textarea name=“body” cols=“60” rows=“15” class="">

. Looks like the issue could be related to TinyMCE as in other text areas such as

<textarea name=“authors[0][affiliation]” class=“textArea” id=“authors-0-affiliation” rows=“5” cols=“40”>

the text appears as already formatted in its own TinyMCE field.

However, for director/notifyUsers in

<textarea name=“body” cols=“60” rows=“15” class="">

TinyMCE doesn’t trigger even if its script is already loaded in the page source code.

I found out that for some reason there was only class="" instead of class=“textArea” in /templates/director/notifyUsers.tpl which is needed for TinyMCE to function properly. After adding textArea to class="" it started to work as expected.

So, I think I’m all set now.

Thank you for your support and help!

Regards,
Dragomir

1 Like