Why HTML tags disappear in email text after having sent the message

Phoca Email (Newsletter) - sending emails and managing newsletters in Joomla! CMS
User avatar
f.gruber
Phoca Member
Phoca Member
Posts: 39
Joined: 12 Sep 2012, 11:47

Why HTML tags disappear in email text after having sent the message

Post by f.gruber »

Since my fist days of using Phoca Email extension I wonder, why all HTML tags get lost, after the email has been sent.

Can this behaviour be changed?

Thanks for answering.
Ferdinand
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Why HTML tags disappear in email text after having sent the message

Post by Jan »

Hi, which HTML tags you mean? Which part do you mean? Sending email or newsletter?

Jan
If you find Phoca extensions useful, please support the project
User avatar
f.gruber
Phoca Member
Phoca Member
Posts: 39
Joined: 12 Sep 2012, 11:47

Re: Why HTML tags disappear in email text after having sent the message

Post by f.gruber »

This problem is related to Phoca Email.
Let me give an example:
I create a Mail message in Phoca Email using the graphical editor as usual. Now I switch to the code view, to show the created HTML. This is the HTML text:

Code: Select all

<h1>Message</h1>
<h2>Test</h2>
<p><em>This</em> is a <strong>HTML</strong> Mail. It was sent with <span style="color: #0000ff;">Phoca Email</span> Component.</p>
Now I click on the SEND button. After having sent the E-Mail, the text in the editor window has changed to plain text:

Code: Select all

<p>Message Test This is a HTML Mail. It was sent with Phoca Email Component.</p>
As you can see, all HTML tags have got removed.

However, the recipient received the message as HTML formatted text.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Why HTML tags disappear in email text after having sent the message

Post by Jan »

Hi,

so my idea is following:

Phoca Email gets the HTML version and send the HTML version. The second function is to save the content but this will be stripped by editor function. :idea:

The question is, does the recipent get the right HTML? With all the set HTML tags?

Can you paste me the screenshot of situation before and after sending?

Jan
If you find Phoca extensions useful, please support the project
User avatar
f.gruber
Phoca Member
Phoca Member
Posts: 39
Joined: 12 Sep 2012, 11:47

Re: Why HTML tags disappear in email text after having sent the message

Post by f.gruber »

Jan wrote: 18 Nov 2021, 23:04 .. The question is, does the recipent get the right HTML? With all the set HTML tags? ...
Yes, the recipient gets the HTML Mail including all HTML tags as expected.

Screenshot of the mail message in the editor before having sent:
Image

Screenshot of the mail message in the editor after having sent:
Image
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Why HTML tags disappear in email text after having sent the message

Post by Jan »

Hi, when you switch to standard tinyMCE editor (for test only), do you get the same problem?

Jan
If you find Phoca extensions useful, please support the project
User avatar
f.gruber
Phoca Member
Phoca Member
Posts: 39
Joined: 12 Sep 2012, 11:47

Re: Why HTML tags disappear in email text after having sent the message

Post by f.gruber »

It makes no difference whether I use the TinyMCE Editor or the other. After click on SEND all HTML tags in the editor window are gone.
But the recipient gets the mail message with all HTML tags.

Maybe the title (subject) of this thread may not be entirely okay.
The right question is:
Why HTML tags disappear in the editor window after having sent the message
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Why HTML tags disappear in email text after having sent the message

Post by Jan »

Hi, sorry for missunderstanding, I forgot about the limit in Joomla core, described here:

administrator/components/com_phocaemail/controllers/phocaemailwrite.php ... line 119

Code: Select all

// ==========================================================================================
			// Remember the HTML -  GUIDE to edit core file
			// Comment the following line
			$app->getUserStateFromRequest( $context.'message', 'message', $post['message'], 'html' );

			// Uncomment the following line
			//$app->getUserStateFromRequest( $context.'message', 'message', $post['message'], 'string' );

			// EDIT
			// file: libraries/joomla/application/application.php
			// line: cca 514
			// FROM:
			// public function getUserStateFromRequest($key, $request, $default = null, $type = 'none')
			// TO:
			// public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $mask = 0)
			//
			// line: cca 518
			// FROM:
			// $new_state = $app->input->get($request, null, 'default', $type);
			// TO:
			// $new_state = $app->input->get($request, null, 'default', $type, $mask);

			// ==========================================================================================
I will try to find out, if something changed in this area in Joomla core but it looks like the only way to solve it is the core hack :-(

EDIT: BTW it looks like the raw methods is working in Joomla 4, so if somebody uses Joomla 4, try to open this file:
administrator/components/com_phocaemail/controllers/phocaemailwrite.php line 122
and edit from:

Code: Select all

$app->getUserStateFromRequest( $context.'message', 'message', $post['message'], 'html' );
to:

Code: Select all

$app->getUserStateFromRequest( $context.'message', 'message', $post['message'], 'raw' );
And let me know if this is workign for you.

Jan
If you find Phoca extensions useful, please support the project
Post Reply