Emails from Messages do not retain their HTML tags

Email notifications from Messages do not retain their  HTML tags, while comments do, i.e. Messages are sent only as text, even though they are composed in an editor.

I've tried CKEditor and extended tinymce plugins.




  • Thank you iionly, but I do not need this plugin since I use Amazon SES which sends emails with plain text and html versions at one stroke.

    It seems that my question was not clear enough, so let me explain...

    When you create a new DISCUSSION, you use HTML editor (CKEditor or TinyMCE). Elgg sends HTML email notifications (not PLAIN TEXT).

    When you create a new MESSAGE, you also use HTML editor (CKEditor or TinyMCE). However, in this case Elgg sends only PLAIN TEXT (not HTML). In my mind, it is preferable to send the HTML email - how to fix?

    In addition the workflow of the creation of new DISCUSSION is different from new MESSAGE.

    After you click SEND the new DISCUSSION, you get a page were you can see the newly created DISCUSSION, which is good feedback (in my mind).

    However, after you click SEND the new MESSAGE you get the MESSAGES INBOX page without your new MESSAGE. You have to find it somewhere else. I think the workflow of the DISCUSSION is much more user friendly. - how to fix?

    Thank you


  • By default Elgg strips all HTML before sending an email (see here) If that isn't the case for you then maybe you already have a plugin which handles sending e-mails and maybe that plugin somehow doesn't support Messages.

  • I can't provide you a solution here I can only explain why it is as it is. Maybe it would make sense to discuss the difference and maybe not making a difference with "normal" email notifications and email notifications on sent messages in a future version of Elgg.

    I remember now that you had asked about the sending of mails with Amazon SES and I think I had made a posting how to fix the usage of the 'email', 'system' plugin hook for this. This plugin hook is triggered within the elgg_send_email() function of Elgg core. This function deals with sending of emails and the plugin hook is triggered BEFORE the html tags are stripped. This works for all kind of email notifications EXCEPT the email notifications sent about receiving a message composed by the messages plugin. In this case the on-site messages are saved (both for sender and receiver) before the html tags are stripped. But BEFORE the email notification is sent (by usage of notify_user()) the html tags are stripped. The body content that is reaching the elgg_send_email() function therefore has already no html tags anymore.

    I can't say right now if it would be safe to just remove the strip_tags() call in the messages_send() function in start.php of the messages plugin. Or if the html_email_handler plugin would still be usable in your case in case it would be possible to modify it to send the mails with Amazon SES in the end. I guess either way you would have to make some modifications on your own at least for the time being.

    As with redirecting after sending a message I guess there might be pros/cons for either way. As it is the messages plugin send action forwards to the inbox after it has finished sending the mail. If it would be modified it could also redirect to the messages/sent page instead. It never bothered me that I land in the inbox actually and first had to test what exactly you mean even. I guess some people like it better this way while other like it better the other way.

  • Thank you Jerome - You are right, as you can read in the answer of iionly, I use another plugin which handle emails.

    Thank you iionly for the detailed and helpful answer. The situation is clear now.

    Thanks a lot